summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon McAnsh <brandon.mcansh@gmail.com>2016-09-14 10:37:06 -0400
committerBrandon McAnsh <brandon.mcansh@gmail.com>2016-09-14 07:38:39 -0700
commitda86a759b322d8032f434d60bb09e7accce2fd1e (patch)
treefa862bd182d0436a44113da6f9934c3c4bae9388
parentc79bd4d34880c7be662208ddfe35d81559a3459a (diff)
downloadandroid_packages_apps_Snap-da86a759b322d8032f434d60bb09e7accce2fd1e.zip
android_packages_apps_Snap-da86a759b322d8032f434d60bb09e7accce2fd1e.tar.gz
android_packages_apps_Snap-da86a759b322d8032f434d60bb09e7accce2fd1e.tar.bz2
Snap: SettingsManager: Assert CameraCharacteristics before accessing them
Change-Id: If3e3a9851490c929c39109d96781cd97dabbe597 Signed-off-by: Brandon McAnsh <brandon.mcansh@gmail.com>
-rw-r--r--src/com/android/camera/SettingsManager.java30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java
index 971a227..1380a5e 100644
--- a/src/com/android/camera/SettingsManager.java
+++ b/src/com/android/camera/SettingsManager.java
@@ -136,21 +136,23 @@ public class SettingsManager implements ListMenu.SettingsListener {
String cameraId = cameraIdList[i];
CameraCharacteristics characteristics
= manager.getCameraCharacteristics(cameraId);
- Byte monoOnly = 0;
- try {
- monoOnly = characteristics.get(CaptureModule.MetaDataMonoOnlyKey);
- }catch(Exception e) {
- }
- if (monoOnly == 1) {
- CaptureModule.MONO_ID = i;
- mIsMonoCameraPresent = true;
- }
- int facing = characteristics.get(CameraCharacteristics.LENS_FACING);
- if (facing == CameraCharacteristics.LENS_FACING_FRONT) {
- CaptureModule.FRONT_ID = i;
- mIsFrontCameraPresent = true;
+ if (characteristics != null) {
+ Byte monoOnly = 0;
+ try {
+ monoOnly = characteristics.get(CaptureModule.MetaDataMonoOnlyKey);
+ }catch(Exception e) {
+ }
+ if (monoOnly == 1) {
+ CaptureModule.MONO_ID = i;
+ mIsMonoCameraPresent = true;
+ }
+ int facing = characteristics.get(CameraCharacteristics.LENS_FACING);
+ if (facing == CameraCharacteristics.LENS_FACING_FRONT) {
+ CaptureModule.FRONT_ID = i;
+ mIsFrontCameraPresent = true;
+ }
+ mCharacteristics.add(i, characteristics);
}
- mCharacteristics.add(i, characteristics);
}
} catch (CameraAccessException e) {
e.printStackTrace();