diff --git a/database/database.go b/database/database.go index 8cd966e..2433737 100644 --- a/database/database.go +++ b/database/database.go @@ -132,7 +132,7 @@ func RemoveLine(jid string) bool { func GetLine(jid string) *DatabaseLine { ret := getLine(jid) - if ret.SteamLogin == "" { + if ret == nil || ret.SteamLogin == "" { log.Printf("%sLine empty", LogDebug) return nil } diff --git a/xmpp/commands.go b/xmpp/commands.go index dfcb348..ab1a497 100644 --- a/xmpp/commands.go +++ b/xmpp/commands.go @@ -108,18 +108,22 @@ func execCommandAdHoc(iq *xmpp.Iq) { jidBare := strings.SplitN(iq.From, "/", 2)[0] dbUser := database.GetLine(jidBare) - dbUser.Debug = !dbUser.Debug - g := MapGatewayInfo[jidBare] - ok := dbUser.UpdateLine() - if ok && g != nil { - g.DebugMessage = dbUser.Debug - if dbUser.Debug { - note.Value = "Debug activated." + if dbUser != nil { + dbUser.Debug = !dbUser.Debug + g := MapGatewayInfo[jidBare] + ok := dbUser.UpdateLine() + if ok && g != nil { + g.DebugMessage = dbUser.Debug + if dbUser.Debug { + note.Value = "Debug activated." + } else { + note.Value = "Debug desactivated." + } } else { - note.Value = "Debug desactivated." + note.Value = "Failed to update your profile. :(" } } else { - note.Value = "Failed to update your profile. :(" + note.Value = "Your not registered." } cmd.Note = *note