Fix NPE for social widget when contact loader has error / contact not found
Bug: 5217576
Change-Id: I67814b6f923ff6880427a1516946928984852315
diff --git a/src/com/android/contacts/socialwidget/SocialWidgetProvider.java b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
index cd6a494..dd44310 100644
--- a/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
+++ b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
@@ -200,7 +200,11 @@
views.setTextViewText(R.id.name, sb);
views.setViewVisibility(R.id.name, View.VISIBLE);
views.setViewVisibility(R.id.name_and_snippet, View.GONE);
- views.setOnClickPendingIntent(R.id.widget_container, defaultIntent);
+ // Don't set a pending intent if the intent is null, otherwise the system will try
+ // to write the null intent to a Parcel.
+ if (defaultIntent != null) {
+ views.setOnClickPendingIntent(R.id.widget_container, defaultIntent);
+ }
} else {
// TODO: Rotate between all the stream items?
StreamItemEntry streamItem = streamItems.get(0);