diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-08-08 10:25:24 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2014-08-08 10:26:24 -0700 |
commit | d0a55315761bac64c3e53484def02da3644b1632 (patch) | |
tree | da805d6cfba9d0df312ae8385571cba58ec14ca0 /src/com | |
parent | 6cd90f45b7fb7324eef9d05ae38e0e26bfc934d5 (diff) | |
download | packages_apps_Settings-d0a55315761bac64c3e53484def02da3644b1632.tar.gz packages_apps_Settings-d0a55315761bac64c3e53484def02da3644b1632.tar.bz2 packages_apps_Settings-d0a55315761bac64c3e53484def02da3644b1632.zip |
Avoid NPE when template rapidly switched.
Monkeys can race and end up swapping template before the dialog
is shown.
Bug: 16660160
Change-Id: I301784d707ee3998c38cf2874f7016a5c5350825
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/settings/DataUsageSummary.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java index ec5212811..009c7583c 100644 --- a/src/com/android/settings/DataUsageSummary.java +++ b/src/com/android/settings/DataUsageSummary.java @@ -1791,10 +1791,12 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable public static void show(DataUsageSummary parent) { if (!parent.isAdded()) return; + final NetworkPolicy policy = parent.mPolicyEditor.getPolicy(parent.mTemplate); + if (policy == null) return; + final Resources res = parent.getResources(); final CharSequence message; - final long minLimitBytes = (long) ( - parent.mPolicyEditor.getPolicy(parent.mTemplate).warningBytes * 1.2f); + final long minLimitBytes = (long) (policy.warningBytes * 1.2f); final long limitBytes; // TODO: customize default limits based on network template |