From d22eebefdb87f6bb1d05d43c08105bef4e0954e0 Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Mon, 28 Sep 2020 23:17:37 -0700 Subject: [PATCH] [GraphicsEnvironment] Avoid null access. Currently when debug layer apk is not installed, GraphicsEnvironment logs the message and proceeds, which results in null pointer access crash when later trying to access primaryAbi. Avoid null access by an early return statement. Bug: b/175699044 Test: specify not installed debug layer apk and no crash Change-Id: I4f3b86b0a8cfff4fc608b3a59ebf0872db0465ff Merged-In: I4f3b86b0a8cfff4fc608b3a59ebf0872db0465ff (cherry picked from commit c5c17e66ba236bcd44240308dfcf4fe0a794ccbd) --- core/java/android/os/GraphicsEnvironment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java index df58a6c636f5a..ae577ba0a25e6 100644 --- a/core/java/android/os/GraphicsEnvironment.java +++ b/core/java/android/os/GraphicsEnvironment.java @@ -248,6 +248,7 @@ public class GraphicsEnvironment { } if (appInfo == null) { Log.w(TAG, "Debug layer app '" + packageName + "' not installed"); + return ""; } final String abi = chooseAbi(appInfo);