OSDN Git Service

SurfaceFlinger: Fix null pointer exception
authorDan Stoza <stoza@google.com>
Mon, 9 Mar 2015 17:04:11 +0000 (10:04 -0700)
committerDan Stoza <stoza@google.com>
Mon, 9 Mar 2015 17:04:11 +0000 (10:04 -0700)
Fixes a null pointer exception in getActiveConfig

Bug: 19416124
Change-Id: I45a01f67affb63a348866ce42a6013c5eb71fe8f

services/surfaceflinger/SurfaceFlinger.cpp

index 6a5a39e..1069580 100644 (file)
@@ -617,7 +617,11 @@ status_t SurfaceFlinger::getDisplayStats(const sp<IBinder>& /* display */,
 }
 
 int SurfaceFlinger::getActiveConfig(const sp<IBinder>& display) {
-    return getDisplayDevice(display)->getActiveConfig();
+    sp<DisplayDevice> device(getDisplayDevice(display));
+    if (device != NULL) {
+        return device->getActiveConfig();
+    }
+    return BAD_VALUE;
 }
 
 void SurfaceFlinger::setActiveConfigInternal(const sp<DisplayDevice>& hw, int mode) {