Skip to content

Commit

Permalink
Fix panic conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
DaneEveritt committed Feb 5, 2022
1 parent 9f985ae commit 5d1d3cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion router/websocket/listeners.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ func (h *Handler) listenForServerEvents(ctx context.Context) error {
}
onError(server.InstallOutputEvent, sendErr)
case b := <-eventChan:
e := events.MustDecode(b)
var e events.Event
if err := events.DecodeTo(b, &e); err != nil {
continue
}
var sendErr error
message := Message{Event: e.Topic}
if str, ok := e.Data.(string); ok {
Expand Down
5 changes: 4 additions & 1 deletion server/listeners.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ func (s *Server) StartEventListeners() {
select {
case v := <-c:
go func(v []byte, limit *diskSpaceLimiter) {
e := events.MustDecode(v)
var e events.Event
if err := events.DecodeTo(v, &e); err != nil {
return
}
switch e.Topic {
case environment.ResourceEvent:
{
Expand Down

0 comments on commit 5d1d3cc

Please sign in to comment.