From f05247e74217626637cb05a9b2a795d626ac57f6 Mon Sep 17 00:00:00 2001 From: diginatu Date: Thu, 5 Jan 2017 19:12:25 +0900 Subject: [PATCH] fix panic with nil pointer Panic will be occurred when try to send a comment while not connecting to any live. --- plugin_message.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin_message.go b/plugin_message.go index fc3a29f..bd8cac4 100644 --- a/plugin_message.go +++ b/plugin_message.go @@ -49,6 +49,9 @@ func processPluginMessage(cv *CommentViewer, m *Message) error { cv.Disconnect() case CommQueryBroadSendComment: + if cv.Cmm == nil { + return nicolive.MakeError(nicolive.ErrOther, "not connected to live") + } var ct CtQueryBroadSendComment if err := json.Unmarshal(m.Content, &ct); err != nil { return nicolive.MakeError(nicolive.ErrOther, "JSON error in the content : "+err.Error())