summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcos Marado <mmarado@cyngn.com>2016-04-14 14:41:42 (GMT)
committerMarcos Marado <mmarado@cyngn.com>2016-04-14 14:43:22 (GMT)
commit95d19347d6f6f20658f29286c7e3ce81e97d9b97 (patch)
treef6b27f042a5a8bccd992fd1c3ffdf81702e0681a /src
parent5e5f8259c31ce5c628922f0ce0760df6704856bb (diff)
downloadandroid_packages_apps_Trebuchet-95d19347d6f6f20658f29286c7e3ce81e97d9b97.zip
android_packages_apps_Trebuchet-95d19347d6f6f20658f29286c7e3ce81e97d9b97.tar.gz
android_packages_apps_Trebuchet-95d19347d6f6f20658f29286c7e3ce81e97d9b97.tar.bz2
avoid NPE
Change-Id: I8a2d74c8c305112fcbb76d56b126d15a6015de8b
Diffstat (limited to 'src')
-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 05184cf..bdb5c5b 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -547,23 +547,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.