1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

client: don't return typed nil in UploadImage

This commit is contained in:
wdvxdr 2022-06-18 23:12:10 +08:00
parent 3f5174dda1
commit 6e1792c6b1
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6

View File

@ -48,7 +48,13 @@ func (c *QQClient) UploadImage(target message.Source, img io.ReadSeeker, thread
case message.SourceGroup, message.SourceGuildChannel, message.SourceGuildDirect: case message.SourceGroup, message.SourceGuildChannel, message.SourceGuildDirect:
return c.uploadGroupOrGuildImage(target, img, thread...) return c.uploadGroupOrGuildImage(target, img, thread...)
case message.SourcePrivate: case message.SourcePrivate:
return c.uploadPrivateImage(target.PrimaryID, img, 0) img, err := c.uploadPrivateImage(target.PrimaryID, img, 0)
// Note: we need this check, we should return untyped nil instead of (*FriendImageElement)(nil)
// TODO: change c.uploadPrivateImage signature after delete c.UploadPrivateImage
if err != nil {
return nil, err
}
return img, nil
default: default:
return nil, errors.New("unsupported target type") return nil, errors.New("unsupported target type")
} }