From c11576fe2d59f3f256019dfa5a7b4ec92ca63d44 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Tue, 18 Mar 2025 14:11:55 -0700 Subject: [PATCH] WebView: defend against null array This guards against iterating over a null array. This scenario should never happen on user devices, however we know it can happen if you install a trunk-staging build of the settings app on top of a nextfood device configuration. This happens because of a flag mismatch (updateServiceIpcWrapper is enabled in the trunk-staging app but the service is not implemented by a nextfood platform build). This is a low risk change since we know users cannot usually get into this state. Fixed: 391725109 Test: N/A - this bug is not possible in any configuration we test Flag: EXEMPT bugfix Change-Id: I654e0be5ad94e769cd8325ce5d20d241a4a13c13 --- .../android/settings/webview/WebViewUpdateServiceWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/webview/WebViewUpdateServiceWrapper.java b/src/com/android/settings/webview/WebViewUpdateServiceWrapper.java index 546320c2aac..25ee48ea1b1 100644 --- a/src/com/android/settings/webview/WebViewUpdateServiceWrapper.java +++ b/src/com/android/settings/webview/WebViewUpdateServiceWrapper.java @@ -61,7 +61,7 @@ public class WebViewUpdateServiceWrapper { * validity of a package is not dependent on whether the package is installed/enabled. */ public List getValidWebViewApplicationInfos(Context context) { - WebViewProviderInfo[] providers = null; + WebViewProviderInfo[] providers = new WebViewProviderInfo[0]; try { if (android.webkit.Flags.updateServiceIpcWrapper()) { providers = context.getSystemService(WebViewUpdateManager.class)