Settings: Fix QrCamera crash on devices without flash
Change-Id: Ife34b5fb87a9a4f509b665a3433e0b2ba857c885
diff --git a/src/com/android/settings/wifi/qrcode/QrCamera.java b/src/com/android/settings/wifi/qrcode/QrCamera.java
index c682587..00f0348 100644
--- a/src/com/android/settings/wifi/qrcode/QrCamera.java
+++ b/src/com/android/settings/wifi/qrcode/QrCamera.java
@@ -178,7 +178,9 @@
Size pictureSize = getBestPictureSize(mParameters);
mParameters.setPreviewSize(pictureSize.getWidth(), pictureSize.getHeight());
- if (mParameters.getSupportedFlashModes().contains(Parameters.FLASH_MODE_OFF)) {
+ final List<String> supportedFlashModes = mParameters.getSupportedFlashModes();
+ if (supportedFlashModes != null &&
+ supportedFlashModes.contains(Parameters.FLASH_MODE_OFF)) {
mParameters.setFlashMode(Parameters.FLASH_MODE_OFF);
}