OpenEVSE: fix null pointer (#4515)
This commit is contained in:
parent
91e1ceac38
commit
912af5f260
1 changed files with 4 additions and 2 deletions
|
|
@ -187,15 +187,17 @@ func (c *OpenEVSE) Enabled() (bool, error) {
|
|||
}
|
||||
|
||||
if overrideResp.JSON200 != nil && overrideResp.JSON200.State != nil {
|
||||
switch *overrideResp.JSON200.State {
|
||||
switch state := *overrideResp.JSON200.State; state {
|
||||
case "disabled":
|
||||
return false, nil
|
||||
case "enabled", "active":
|
||||
return true, nil
|
||||
default:
|
||||
return false, fmt.Errorf("unknown EVSE state: %s", state)
|
||||
}
|
||||
}
|
||||
|
||||
return false, fmt.Errorf("unknown EVSE state: %s", *overrideResp.JSON200.State)
|
||||
return false, errors.New("invalid EVSE state")
|
||||
}
|
||||
|
||||
// Enable implements the api.Charger interface
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue