Skip to content

Commit

Permalink
fix: empty subscribe message
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangliang committed Jan 29, 2023
1 parent f26bbb7 commit 15262c5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/agent/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,18 @@ func (g *GqlSubscriber) GqlSubscriberWrapHandler(name string, tick Ticker) Messa
log.Error("receive event data error", zap.Error(err))
return err
}
if message == nil {
return fmt.Errorf("receive raw message nil")
}
var rawMsg Message
err = json.Unmarshal(*message, &rawMsg)
if err != nil {
log.Error("unmarshal message error", zap.Error(err))
return err
}
if rawMsg.Data == nil {
return fmt.Errorf("receive raw message.data nil: %s", string(*message))
}
if g.reply != nil {
err = json.Unmarshal(*rawMsg.Data, g.reply)
if err != nil {
Expand Down

0 comments on commit 15262c5

Please sign in to comment.