Avoid NPE in NightDisplayService when VR mode is invoked

Bug: b/32086748

Test: I was seeing the crash without the CL. With the CL no more crash.
Change-Id: I286af1066ce8928ed72a83a8da645fe99953fd85
This commit is contained in:
Steven Thomas
2017-01-10 16:54:42 -08:00
committed by Alex Vakulenko
parent 362b4131bc
commit 1e9b4b07c9

View File

@@ -111,7 +111,7 @@ public final class NightDisplayService extends SystemService
getLocalService(DisplayTransformManager.class);
if (enabled) {
dtm.setColorMatrix(LEVEL_COLOR_MATRIX_NIGHT_DISPLAY, MATRIX_IDENTITY);
} else if (mController.isActivated()) {
} else if (mController != null && mController.isActivated()) {
dtm.setColorMatrix(LEVEL_COLOR_MATRIX_NIGHT_DISPLAY, MATRIX_NIGHT);
}
}