Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
add extra safety
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Feb 21, 2024
1 parent be6f70e commit 0f8deb5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/signalmeow/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ func (cli *Client) DownloadUserAvatar(ctx context.Context, avatarPath string, pr
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}
if encryptedAvatar == nil {
return nil, fmt.Errorf("failed to read response body: encryptedAvatar was nil")
}
if profileKey == nil {
return nil, fmt.Errorf("failed to read response body: profileKey was nil")
}
avatar, err := decryptBytes(profileKey[:], encryptedAvatar)
if err != nil {
return nil, fmt.Errorf("failed to decrypt response: %w", err)
Expand Down

0 comments on commit 0f8deb5

Please sign in to comment.