From 5f3716d1de8b02af06896e4ec0e5495b2ac383fa Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Tue, 5 Dec 2017 10:36:08 -0800 Subject: [PATCH] Catch a rare NPE due in SuggestionController In monkey test, suggestion service can detach right before UI tries to query. Change-Id: Ic2eeb81140f5b5d38688fbe92d20f68b9fa48c34 Fixes: 69979152 Test: monkey --- .../settings/dashboard/suggestions/SuggestionController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/settings/dashboard/suggestions/SuggestionController.java b/src/com/android/settings/dashboard/suggestions/SuggestionController.java index ef57d836e12..8fe1a479686 100644 --- a/src/com/android/settings/dashboard/suggestions/SuggestionController.java +++ b/src/com/android/settings/dashboard/suggestions/SuggestionController.java @@ -104,6 +104,9 @@ public class SuggestionController { } try { return mRemoteService.getSuggestions(); + } catch (NullPointerException e) { + Log.w(TAG, "mRemote service detached before able to query", e); + return null; } catch (RemoteException e) { Log.w(TAG, "Error when calling getSuggestion()", e); return null;