fix nil on client.Send
This commit is contained in:
parent
e44fb17f40
commit
75f22d176a
|
@ -65,6 +65,8 @@ func Init(configInterface interface{}, db *database.DB, bot *bot.Bot) output.Out
|
|||
return nil
|
||||
}
|
||||
cm := xmpp.NewStreamManager(client, func(c xmpp.Sender) {
|
||||
out.client = c
|
||||
|
||||
for to, muc := range config.Defaults {
|
||||
def := &database.Notify{
|
||||
Protocol: proto,
|
||||
|
@ -84,7 +86,6 @@ func Init(configInterface interface{}, db *database.DB, bot *bot.Bot) output.Out
|
|||
}
|
||||
}
|
||||
logger.Info("join muc after connect")
|
||||
out.client = c
|
||||
})
|
||||
go func() {
|
||||
cm.Run()
|
||||
|
|
|
@ -31,6 +31,10 @@ func (out *Output) Join(to string) {
|
|||
}
|
||||
|
||||
func (out *Output) Send(e *log.Entry, to *database.Notify) bool {
|
||||
if out.client == nil {
|
||||
logger.Error("xmpp not connected (yet)")
|
||||
return false
|
||||
}
|
||||
html, text := formatLog(e)
|
||||
if html == "" || text == "" {
|
||||
logger.Error("during format notify")
|
||||
|
|
Loading…
Reference in New Issue