From 6ced2ff293f89773cfa1c7facda29ad931b0dc5e Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Fri, 25 Jan 2013 14:41:14 -0800 Subject: [PATCH] CB-2292: Added a check for width and height. You can't scale nothing because you can't divide by zero. --- framework/src/org/apache/cordova/CameraLauncher.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/CameraLauncher.java b/framework/src/org/apache/cordova/CameraLauncher.java index f9edd10f..3012ee3c 100755 --- a/framework/src/org/apache/cordova/CameraLauncher.java +++ b/framework/src/org/apache/cordova/CameraLauncher.java @@ -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);