CB-2292: Added a check for width and height. You can't scale nothing because you can't divide by zero.

This commit is contained in:
Joe Bowser 2013-01-25 14:41:14 -08:00
parent d9b15cf69e
commit 6ced2ff293

View File

@ -571,7 +571,13 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(imagePath, options);
//CB-2292: WTF? Why is the width null?
if(options.outWidth == 0 || options.outHeight == 0)
{
return null;
}
// determine the correct aspect ratio
int[] widthHeight = calculateAspectRatio(options.outWidth, options.outHeight);