summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-07-17 16:17:40 -0700
committerRomain Guy <romainguy@android.com>2009-07-17 16:18:27 -0700
commit6c8bbcb5a2bbae2c83e1c684c2a06b8b72b47f52 (patch)
tree629801885147fa6174b1dc18cd1daf505aca39c7
parent27f98955ad7d6aad05bdddba75b98067cc2e208f (diff)
downloadLauncher-6c8bbcb5a2bbae2c83e1c684c2a06b8b72b47f52.tar.gz
Fixes #1930069. Prevents NPE in GesturesActivity. Ensures the store is always != null.
-rw-r--r--src/com/android/launcher/GesturesActivity.java2
-rw-r--r--src/com/android/launcher/Launcher.java12
2 files changed, 7 insertions, 7 deletions
diff --git a/src/com/android/launcher/GesturesActivity.java b/src/com/android/launcher/GesturesActivity.java
index 0b66ae1..5c67a1e 100644
--- a/src/com/android/launcher/GesturesActivity.java
+++ b/src/com/android/launcher/GesturesActivity.java
@@ -81,7 +81,7 @@ public class GesturesActivity extends ListActivity implements AdapterView.OnItem
setListAdapter(new GesturesSettingsAdapter(mAdapter));
getListView().setOnItemClickListener(this);
- mStore = Launcher.getGestureLibrary();
+ mStore = Launcher.getGestureLibrary(this);
mTask = (GesturesLoadTask) new GesturesLoadTask().execute();
registerForContextMenu(getListView());
diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java
index 8ac47d0..bf2be91 100644
--- a/src/com/android/launcher/Launcher.java
+++ b/src/com/android/launcher/Launcher.java
@@ -246,11 +246,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
super.onCreate(savedInstanceState);
mInflater = getLayoutInflater();
- if (sLibrary == null) {
- // The context is not kept by the library so it's safe to do this
- sLibrary = GestureLibraries.fromPrivateFile(Launcher.this,
- GesturesConstants.STORE_NAME);
- }
+ getGestureLibrary(this);
mAppWidgetManager = AppWidgetManager.getInstance(this);
@@ -1983,7 +1979,11 @@ public final class Launcher extends Activity implements View.OnClickListener, On
return sModel;
}
- static GestureLibrary getGestureLibrary() {
+ static GestureLibrary getGestureLibrary(Context context) {
+ if (sLibrary == null) {
+ // The context is not kept by the library so it's safe to do this
+ sLibrary = GestureLibraries.fromPrivateFile(context, GesturesConstants.STORE_NAME);
+ }
return sLibrary;
}