From 7addcf93ff0350edef02cae510df8c062bf876dd Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 24 May 2018 11:49:05 +0100 Subject: [PATCH] Fixed another typo and bug Use a sql.NullInt64 instead of an Int64 as that allows for values to sometimes be null when pulling from a postgres table. Can result in error otherwise. Signed-off-by: Andrew Morgan --- .../dendrite/clientapi/auth/storage/devices/devices_table.go | 2 +- src/github.com/matrix-org/dendrite/clientapi/routing/device.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go index c8ece6b91..9512acfc0 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go @@ -173,7 +173,7 @@ func (s *devicesStatements) selectDeviceByID( ctx context.Context, localpart, deviceID string, ) (*authtypes.Device, error) { var dev authtypes.Device - var created int64 + var created sql.NullInt64 stmt := s.selectDeviceByIDStmt err := stmt.QueryRowContext(ctx, localpart, deviceID).Scan(&created) if err == nil { diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/device.go b/src/github.com/matrix-org/dendrite/clientapi/routing/device.go index d519c8a6a..cf6f24a7d 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/device.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/device.go @@ -40,7 +40,7 @@ type deviceUpdateJSON struct { DisplayName *string `json:"display_name"` } -// GetDeviceByID handles /device/{deviceID} +// GetDeviceByID handles /devices/{deviceID} func GetDeviceByID( req *http.Request, deviceDB *devices.Database, device *authtypes.Device, deviceID string,