forked from chteufleur/go-xmpp4steam
Fix nil pointer on database.GetLine()
This commit is contained in:
parent
a6281fe093
commit
149c5f9117
|
|
@ -132,7 +132,7 @@ func RemoveLine(jid string) bool {
|
||||||
func GetLine(jid string) *DatabaseLine {
|
func GetLine(jid string) *DatabaseLine {
|
||||||
ret := getLine(jid)
|
ret := getLine(jid)
|
||||||
|
|
||||||
if ret.SteamLogin == "" {
|
if ret == nil || ret.SteamLogin == "" {
|
||||||
log.Printf("%sLine empty", LogDebug)
|
log.Printf("%sLine empty", LogDebug)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ func execCommandAdHoc(iq *xmpp.Iq) {
|
||||||
|
|
||||||
jidBare := strings.SplitN(iq.From, "/", 2)[0]
|
jidBare := strings.SplitN(iq.From, "/", 2)[0]
|
||||||
dbUser := database.GetLine(jidBare)
|
dbUser := database.GetLine(jidBare)
|
||||||
|
if dbUser != nil {
|
||||||
dbUser.Debug = !dbUser.Debug
|
dbUser.Debug = !dbUser.Debug
|
||||||
g := MapGatewayInfo[jidBare]
|
g := MapGatewayInfo[jidBare]
|
||||||
ok := dbUser.UpdateLine()
|
ok := dbUser.UpdateLine()
|
||||||
|
|
@ -121,6 +122,9 @@ func execCommandAdHoc(iq *xmpp.Iq) {
|
||||||
} else {
|
} else {
|
||||||
note.Value = "Failed to update your profile. :("
|
note.Value = "Failed to update your profile. :("
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
note.Value = "Your not registered."
|
||||||
|
}
|
||||||
|
|
||||||
cmd.Note = *note
|
cmd.Note = *note
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue