Skip to content

Commit

Permalink
check for invalid hardware (nil) before sending to server
Browse files Browse the repository at this point in the history
  • Loading branch information
kqdeng committed Jul 13, 2020
1 parent af50c91 commit 76acd64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions http-server/http-handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func RegisterHardwareServiceHandlerFromEndpoint(ctx context.Context, mux *runtim
return
}

if hw.Id == "" {
writeResponse(w, http.StatusBadRequest, status.Errorf(codes.InvalidArgument, "id must be set to a UUID, got id: %v", hw.Id).Error())
if hw.Hardware == nil || hw.Id == "" {
writeResponse(w, http.StatusBadRequest, status.Errorf(codes.InvalidArgument, "invalid hardware data, must contain an id").Error())
return
}

Expand Down

0 comments on commit 76acd64

Please sign in to comment.