forked from pothtonswer/discordmuffin
Prevent login crash by assuming a json.Unmarshal "just works"
This commit is contained in:
parent
a3ac679d76
commit
2d7ac3557a
1 changed files with 4 additions and 0 deletions
|
@ -111,6 +111,10 @@ func (s *Session) Login(email string, password string) (token string, err error)
|
|||
|
||||
var temp map[string]interface{}
|
||||
err = json.Unmarshal(response, &temp)
|
||||
// prevent crashing by manipulating a map that has no data
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
token = temp["token"].(string)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue