DriveSomethingGreater: gracefully handle empty vehicles
This commit is contained in:
parent
1b08a3461e
commit
b715251e28
1 changed files with 1 additions and 1 deletions
|
|
@ -268,7 +268,7 @@ func (v *API) Vehicles() ([]Vehicle, error) {
|
|||
|
||||
// the response is either a bare array or wrapped in {"vehicles": [...]}
|
||||
var arr []Vehicle
|
||||
if err := json.Unmarshal(b, &arr); err == nil && len(arr) > 0 {
|
||||
if err := json.Unmarshal(b, &arr); err == nil && len(b) > 0 {
|
||||
return arr, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue