summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Marado <mmarado@cyngn.com>2016-04-14 15:41:42 +0100
committerTom Powell <zifnab@zifnab06.net>2017-03-26 16:21:09 -0700
commitbc210d870e950ac3cb5373b929b0184e0131b22b (patch)
treee4f0d787e25cbf7e7c3bed5b1986630e55309022
parentb4ec44001f5fe41712e96f0309219d02334f6b0a (diff)
downloadandroid_packages_apps_Trebuchet-bc210d870e950ac3cb5373b929b0184e0131b22b.zip
android_packages_apps_Trebuchet-bc210d870e950ac3cb5373b929b0184e0131b22b.tar.gz
android_packages_apps_Trebuchet-bc210d870e950ac3cb5373b929b0184e0131b22b.tar.bz2
avoid NPE
Change-Id: I8a2d74c8c305112fcbb76d56b126d15a6015de8b
-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 91376a7..511d91e 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.