Fix panic conditions

This commit is contained in:
Dane Everitt 2022-02-05 12:11:00 -05:00
parent 9f985ae044
commit 5d1d3cc9e6
2 changed files with 8 additions and 2 deletions

View File

@ -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 {

View File

@ -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:
{