Browse Source

Fix handling not found avatars

Tulir Asokan 3 years ago
parent
commit
152f5a57b5
1 changed files with 6 additions and 2 deletions
  1. 6 2
      portal.go

+ 6 - 2
portal.go

@@ -944,9 +944,13 @@ func (user *User) updateAvatar(jid types.JID, avatarID *string, avatarURL *id.Co
 		}
 		return false
 	} else if errors.Is(err, whatsmeow.ErrProfilePictureNotSet) {
-		*avatarURL = id.ContentURI{}
 		avatar = &types.ProfilePictureInfo{ID: "remove"}
-		// Fall through to the rest of the avatar handling code
+		if avatar.ID == *avatarID && *avatarSet {
+			return false
+		}
+		*avatarID = avatar.ID
+		*avatarURL = id.ContentURI{}
+		return true
 	} else if err != nil {
 		log.Warnln("Failed to get avatar URL:", err)
 		return false