Fix NullPointerException in Utils.copyMeProfilePhoto.

Bug: 28221898
Change-Id: I2f67c4ba349a1c831b22174fefd0db6efeffbf1e
This commit is contained in:
Sudheer Shanka
2016-04-15 17:20:54 -07:00
parent 7f4892f223
commit 39975a60cc

View File

@@ -347,11 +347,12 @@ public final class Utils extends com.android.settingslib.Utils {
// If there's no profile photo, assign a default avatar // If there's no profile photo, assign a default avatar
if (avatarDataStream == null) { if (avatarDataStream == null) {
assignDefaultPhoto(context, userId); assignDefaultPhoto(context, userId);
} else { return;
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
Bitmap icon = BitmapFactory.decodeStream(avatarDataStream);
um.setUserIcon(userId, icon);
} }
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
Bitmap icon = BitmapFactory.decodeStream(avatarDataStream);
um.setUserIcon(userId, icon);
try { try {
avatarDataStream.close(); avatarDataStream.close();
} catch (IOException ioe) { } } catch (IOException ioe) { }