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
This commit is contained in:
Svetoslav Ganov
2011-03-03 12:55:52 -08:00
parent 6c8d76527c
commit 11e515cbef

View File

@@ -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;
}
}
}