Fix nil pointer on database.GetLine()

This commit is contained in:
Chteufleur 2016-08-11 19:49:21 +02:00
parent a6281fe093
commit 149c5f9117
2 changed files with 14 additions and 10 deletions

View File

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

View File

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