diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2012-09-27 11:21:12 -0700 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2012-09-27 11:21:12 -0700 |
commit | 88b0140241c646c87d356748621cef28a3105466 (patch) | |
tree | ee5c6877a51e89d5b6e8e69f6cb876de7704ebda /src/com/android/settings/vpn2 | |
parent | 49dc9825569d0c555466303d7d78f1bc75e1602b (diff) | |
download | packages_apps_Settings-88b0140241c646c87d356748621cef28a3105466.zip packages_apps_Settings-88b0140241c646c87d356748621cef28a3105466.tar.gz packages_apps_Settings-88b0140241c646c87d356748621cef28a3105466.tar.bz2 |
Precreate a data structure so it's never null.
Fixes NPE that the fast-fingered monkey sometimes triggers.
bug:7084178
Change-Id: Ibeb5e1ce678f59207de5dd321e06ae88ccc52216
Diffstat (limited to 'src/com/android/settings/vpn2')
-rw-r--r-- | src/com/android/settings/vpn2/VpnSettings.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java index de7c034..9d15435 100644 --- a/src/com/android/settings/vpn2/VpnSettings.java +++ b/src/com/android/settings/vpn2/VpnSettings.java @@ -73,7 +73,7 @@ public class VpnSettings extends SettingsPreferenceFragment implements private final KeyStore mKeyStore = KeyStore.getInstance(); private boolean mUnlocking = false; - private HashMap<String, VpnPreference> mPreferences; + private HashMap<String, VpnPreference> mPreferences = new HashMap<String, VpnPreference>(); private VpnDialog mDialog; private Handler mUpdater; @@ -173,8 +173,7 @@ public class VpnSettings extends SettingsPreferenceFragment implements // Currently we are the only user of profiles in KeyStore. // Assuming KeyStore and KeyGuard do the right thing, we can // safely cache profiles in the memory. - if (mPreferences == null) { - mPreferences = new HashMap<String, VpnPreference>(); + if (mPreferences.size() == 0) { PreferenceGroup group = getPreferenceScreen(); final Context context = getActivity(); |