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

Commit

Permalink
Fix null ref
Browse files Browse the repository at this point in the history
When getResizedImageData fails to scale down an image to a size that'll fit in
the remaining available message space, return null rather than trying to
dereference the null byte array.

Change-Id: Ibb1f5ddd935f952e5f90d8835947cc46bc138aa2
  • Loading branch information
Tom Taylor committed Oct 22, 2009
1 parent b182cae commit cb0668e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/com/android/mms/ui/UriImage.java
Expand Up @@ -283,7 +283,7 @@ private byte[] getResizedImageData(int widthLimit, int heightLimit, int byteLimi
attempts++;
} while ((os == null || os.size() > byteLimit) && attempts < NUMBER_OF_RESIZE_ATTEMPTS);

return os.toByteArray();
return os == null ? null : os.toByteArray();
} catch (FileNotFoundException e) {
Log.e(TAG, e.getMessage(), e);
return null;
Expand Down

0 comments on commit cb0668e

Please sign in to comment.