Merge "Camera2OneCameraManagerImpl: fix NPE when only one camera is available"
diff --git a/src/com/android/camera/one/v2/Camera2OneCameraManagerImpl.java b/src/com/android/camera/one/v2/Camera2OneCameraManagerImpl.java
index 031c610..283ac67 100644
--- a/src/com/android/camera/one/v2/Camera2OneCameraManagerImpl.java
+++ b/src/com/android/camera/one/v2/Camera2OneCameraManagerImpl.java
@@ -145,7 +145,9 @@
             id = findFirstBackCameraId();
         }
 
-        mCameraFacingCache.put(facing, id);
+        if (id != null) {
+            mCameraFacingCache.put(facing, id);
+        }
         return id;
     }