From f1b961033f611ce41132367e0dbf0da100e8fbb5 Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 7 Mar 2018 11:06:41 -0800 Subject: [PATCH] Fix NPE if app context is null Change-Id: Ic21ae50e5421a8c711e133ffe2ff218160382297 Fixes: 74260094 Test: builds, boots, and graphicsstats still works --- core/java/android/view/ThreadedRenderer.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java index e996ea160126..8d076f75ddbb 100644 --- a/core/java/android/view/ThreadedRenderer.java +++ b/core/java/android/view/ThreadedRenderer.java @@ -1068,11 +1068,15 @@ public final class ThreadedRenderer { mInitialized = true; mAppContext = context.getApplicationContext(); - nSetDebuggingEnabled( - (mAppContext.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 - || Build.IS_DEBUGGABLE); initSched(renderProxy); - initGraphicsStats(); + + if (mAppContext != null) { + final boolean appDebuggable = + (mAppContext.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) + != 0; + nSetDebuggingEnabled(appDebuggable || Build.IS_DEBUGGABLE); + initGraphicsStats(); + } } private void initSched(long renderProxy) { -- 2.11.0