summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Wang <jaywang@codeaurora.org>2016-02-03 15:13:49 -0800
committerSteve Kondik <steve@cyngn.com>2016-08-03 15:45:46 -0700
commitb2b382bf30ed6438a1eac9b00261659ad588eaa3 (patch)
treeb0aca3cac92e601e4fa957003d020c35aadbb6dc
parent26d9ea2ff654dfe0f327125d7ef8dda7d96fd5c9 (diff)
downloadandroid_packages_apps_Snap-b2b382bf30ed6438a1eac9b00261659ad588eaa3.zip
android_packages_apps_Snap-b2b382bf30ed6438a1eac9b00261659ad588eaa3.tar.gz
android_packages_apps_Snap-b2b382bf30ed6438a1eac9b00261659ad588eaa3.tar.bz2
SnapdragonCamera: fix null pointer exception
During layout change, it is possible camera preview is not configured, yet and Camera.Parameters.getPreviewSize() returns null pointer. Adding a null check to skip the layout change if the pointer is null Change-Id: Icb3ecf60c261e68cc5f2b05eba4df020857022eb CRs-Fixed: 945969
-rw-r--r--src/com/android/camera/PhotoUI.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index a7aebfb..970e2e5 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -165,7 +165,9 @@ public class PhotoUI implements PieListener,
Camera.Parameters parameters = ((PhotoModule)mController).getParameters();
if(parameters != null) {
Camera.Size size = parameters.getPreviewSize();
- setAspectRatio((float) size.width / size.height);
+ if (size != null) {
+ setAspectRatio((float) size.width / size.height);
+ }
}
}
};