Fix panic, hopefully

This commit is contained in:
Neil Alexander 2021-03-02 10:48:23 +00:00
parent aedf2e6d30
commit 22513afe88
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 2 additions and 6 deletions

View file

@ -513,12 +513,7 @@ func (a *KeyInternalAPI) uploadLocalDeviceKeys(ctx context.Context, req *api.Per
}
func (a *KeyInternalAPI) uploadOneTimeKeys(ctx context.Context, req *api.PerformUploadKeysRequest, res *api.PerformUploadKeysResponse) {
if req.UserID == "" || req.DeviceID == "" {
res.Error = &api.KeyError{
Err: "user ID or device ID missing",
}
}
if len(req.OneTimeKeys) == 0 {
if req.UserID != "" && req.DeviceID != "" && len(req.OneTimeKeys) == 0 {
counts, err := a.DB.OneTimeKeysCount(ctx, req.UserID, req.DeviceID)
if err != nil {
res.Error = &api.KeyError{

View file

@ -161,6 +161,7 @@ func (a *UserInternalAPI) deviceListUpdate(userID string, deviceIDs []string) er
var uploadRes keyapi.PerformUploadKeysResponse
a.KeyAPI.PerformUploadKeys(context.Background(), &keyapi.PerformUploadKeysRequest{
UserID: userID,
DeviceKeys: deviceKeys,
}, &uploadRes)
if uploadRes.Error != nil {