Camera2OneCameraManagerImpl: fix NPE when only one camera is available
* AOSP 10 introduced a crash on devices with only one camera that was
not present on AOSP 9. This was introduced in commit 8b07da, which
added cache to the result of `findCameraId()`, but did not check if
the value is null before adding to cache. Code elsewhere checked the
result of `findCameraId()` to avoid NPEs, but the function itself
would crash if it were ever to return null due to this regression.
* Fixed by simply wrapping the addition to cache in a null check.
1 file changed