Skip to content

Commit

Permalink
Fix up empty namespaces JSON unmarshalling error
Browse files Browse the repository at this point in the history
At present, if the namespaces endpoint returns 0 bytes, there is still
an attempt to unmarshal it, resulting in an unexected end of JSON input
error being passed down.

Signed-off-by: Paul Mundt <paul.mundt@adaptant.io>
  • Loading branch information
pmundt authored and alexellis committed Dec 14, 2019
1 parent eac1bd5 commit df5d764
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions types/function_list_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func (s *FunctionLookupBuilder) getNamespaces() ([]string, error) {
return namespaces, err
}

if len(bytesOut) == 0 {
return namespaces, nil
}

err = json.Unmarshal(bytesOut, &namespaces)
if err != nil {
return namespaces, err
Expand Down

0 comments on commit df5d764

Please sign in to comment.