SF: Check the active mode for nullptr in dumpsys
We alredy have the check for mSupportedModes.size()==0 which
is supposed to be equivalent to getActiveMode()==nullptr.
However it's better to directly null check getActiveMode()
in case the logic changes in the future.
Fixes: 183381694
Test: dumpsys surfaceflinger
Change-Id: I49bdcb9636e3699bb720a84b6f789790c636b9b5
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 8692ee6..da8c080 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -268,8 +268,9 @@
StringAppendF(&result, "+ %s\n", getDebugName().c_str());
StringAppendF(&result, " powerMode=%s (%d)\n", to_string(mPowerMode).c_str(),
static_cast<int32_t>(mPowerMode));
+ const auto activeMode = getActiveMode();
StringAppendF(&result, " activeMode=%s\n",
- mSupportedModes.size() ? to_string(*getActiveMode()).c_str() : "none");
+ activeMode ? to_string(*activeMode).c_str() : "none");
result.append(" supportedModes=\n");