Skip to content

Commit

Permalink
fix bug where card object was accessed before being decoded
Browse files Browse the repository at this point in the history
  • Loading branch information
utkuufuk committed Apr 30, 2022
1 parent 4873b9a commit b11007a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/habit-service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ func handleEntrelloRequest(w http.ResponseWriter, req *http.Request) {
}

var card service.TrelloCard
cell := strings.Split(card.Desc, "\n")[0]
if err = json.Unmarshal(body, &card); err != nil {
logger.Warn("Invalid request body: %v", err)
w.WriteHeader(http.StatusBadRequest)
return
}

cell := strings.Split(card.Desc, "\n")[0]
err = service.UpdateHabit(client, cfg.TimezoneLocation, cell, card.Labels)
if err != nil {
logger.Error("Could not update habit at cell '%s': %v", cell, err)
Expand Down

0 comments on commit b11007a

Please sign in to comment.