OSDN Git Service

Avoid NPE in NightDisplayService when VR mode is invoked
authorSteven Thomas <steventhomas@google.com>
Wed, 11 Jan 2017 00:54:42 +0000 (16:54 -0800)
committerAlex Vakulenko <avakulenko@google.com>
Wed, 1 Feb 2017 23:53:13 +0000 (15:53 -0800)
Bug: b/32086748

Test: I was seeing the crash without the CL. With the CL no more crash.
Change-Id: I286af1066ce8928ed72a83a8da645fe99953fd85

services/core/java/com/android/server/display/NightDisplayService.java

index 0357b1b..7237fdb 100644 (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);
                     }
                 }