From cd7197dd26a87ba2eaa891d5415e25cebc74e45b Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Wed, 5 Apr 2017 11:04:17 -0700 Subject: [PATCH] Fix NPE when adding WebView to ResourcesManager Framework resources have their mResDir set to null, since the framework resources are implicitly always included. Guard against null when checking to see if the Resources mResDir matches the asset path WebView wants to inject itself into. Bug: 36953234 Test: manual Change-Id: Ie3dc0cc1240441a2466585224cdc7c15555c66bf --- core/java/android/app/ResourcesManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java index 489a0f0975aef..d620a81e985b4 100644 --- a/core/java/android/app/ResourcesManager.java +++ b/core/java/android/app/ResourcesManager.java @@ -945,7 +945,7 @@ public class ResourcesManager { final ResourcesKey key = mResourceImpls.keyAt(i); final WeakReference weakImplRef = mResourceImpls.valueAt(i); final ResourcesImpl impl = weakImplRef != null ? weakImplRef.get() : null; - if (impl != null && key.mResDir.equals(assetPath)) { + if (impl != null && Objects.equals(key.mResDir, assetPath)) { if (!ArrayUtils.contains(key.mLibDirs, libAsset)) { final int newLibAssetCount = 1 + (key.mLibDirs != null ? key.mLibDirs.length : 0);