summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/LauncherProvider.java38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 91376a794..511d91e9e 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -546,23 +546,29 @@ public class LauncherProvider extends ContentProvider {
// Database was just created, so wipe any previous widgets
if (mAppWidgetHost != null) {
- mAppWidgetHost.deleteHost();
-
- /**
- * Send notification that we've deleted the {@link AppWidgetHost},
- * probably as part of the initial database creation. The receiver may
- * want to re-call {@link AppWidgetHost#startListening()} to ensure
- * callbacks are correctly set.
- */
- new MainThreadExecutor().execute(new Runnable() {
-
- @Override
- public void run() {
- if (mListener != null) {
- mListener.onAppWidgetHostReset();
+ try {
+ mAppWidgetHost.deleteHost();
+ /**
+ * Send notification that we've deleted the {@link AppWidgetHost},
+ * probably as part of the initial database creation. The receiver may
+ * want to re-call {@link AppWidgetHost#startListening()} to ensure
+ * callbacks are correctly set.
+ */
+ new MainThreadExecutor().execute(new Runnable() {
+
+ @Override
+ public void run() {
+ if (mListener != null) {
+ mListener.onAppWidgetHostReset();
+ }
}
- }
- });
+ });
+ } catch (NullPointerException ex) {
+ // nothing to do here. Why did this pass the null check? I don't know. but this fixes it.
+ // (avoids: Caused by: java.lang.NullPointerException: Attempt to invoke interface method
+ // 'void com.android.internal.appwidget.IAppWidgetService.deleteHost(java.lang.String, int)'
+ // on a null object reference
+ }
}
// Fresh and clean launcher DB.