Skip to content

Commit

Permalink
Fix crash on vehicle not found (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenart12 committed Feb 9, 2025
1 parent 2c55bcd commit de58b3a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ func publishState(ctx context.Context, vin string, http_client *http.Client, mqt
state, err := getState(ctx, vin, http_client, disc.Discovery.DeviceType, &disc.PublishBindings)
// log.Debug("Got state", "state", state)

// Create state map if it doesn't exist
if state == nil {
state = make(map[string]string)
}

// If the context is done, return
if err != nil && ctx.Err() != nil {
return ctx.Err()
Expand Down

0 comments on commit de58b3a

Please sign in to comment.