From 11e515cbefb2d0f38e26cb41c8cd3790f881220c Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Thu, 3 Mar 2011 12:55:52 -0800 Subject: NPE in in AppGlobals#getIntCoreSetting bug:3508658 It ActivityThread#currentActivityThread() is called when the ActivityThread is not attached it returns null and AppGlobals#getIntCoreSetting was not checking for that. Change-Id: I5e00d1947a161ad1e52ecfaa12cbbac3b534a0db --- core/java/android/app/AppGlobals.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/AppGlobals.java b/core/java/android/app/AppGlobals.java index 55515b8ae4d0..2b6db8b590f8 100644 --- a/core/java/android/app/AppGlobals.java +++ b/core/java/android/app/AppGlobals.java @@ -55,6 +55,11 @@ public class AppGlobals { * @return The core settings. */ public static int getIntCoreSetting(String key, int defaultValue) { - return ActivityThread.currentActivityThread().getIntCoreSetting(key, defaultValue); + ActivityThread currentActivityThread = ActivityThread.currentActivityThread(); + if (currentActivityThread != null) { + return currentActivityThread.getIntCoreSetting(key, defaultValue); + } else { + return defaultValue; + } } } -- cgit v1.2.3-59-g8ed1b