mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-14 17:33:48 +01:00
Fix scanning null values in timezone column
This commit is contained in:
parent
8cb41b8949
commit
c7b0f98f97
2 changed files with 3 additions and 2 deletions
|
@ -90,16 +90,17 @@ type User struct {
|
|||
}
|
||||
|
||||
func (user *User) Scan(row Scannable) *User {
|
||||
var username sql.NullString
|
||||
var username, timezone sql.NullString
|
||||
var device, agent sql.NullByte
|
||||
var phoneLastSeen, phoneLastPinged sql.NullInt64
|
||||
err := row.Scan(&user.MXID, &username, &agent, &device, &user.ManagementRoom, &user.SpaceRoom, &phoneLastSeen, &phoneLastPinged, &user.Timezone)
|
||||
err := row.Scan(&user.MXID, &username, &agent, &device, &user.ManagementRoom, &user.SpaceRoom, &phoneLastSeen, &phoneLastPinged, &timezone)
|
||||
if err != nil {
|
||||
if err != sql.ErrNoRows {
|
||||
user.log.Errorln("Database scan failed:", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
user.Timezone = timezone.String
|
||||
if len(username.String) > 0 {
|
||||
user.JID = types.NewADJID(username.String, agent.Byte, device.Byte)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue