mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 22:56:33 +02:00
Prevent crash
This commit is contained in:
@@ -40,7 +40,13 @@ public class WidgetUnified extends AppWidgetProvider {
|
||||
|
||||
static void init(Context context, int appWidgetId) {
|
||||
Log.i("Widget unified init=" + appWidgetId);
|
||||
|
||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||
if (appWidgetManager == null) {
|
||||
Log.w("No app widget manager"); // Fairphone FP2
|
||||
return;
|
||||
}
|
||||
|
||||
update(context, appWidgetManager, new int[]{appWidgetId});
|
||||
}
|
||||
|
||||
@@ -48,6 +54,11 @@ public class WidgetUnified extends AppWidgetProvider {
|
||||
Log.i("Widget unified update");
|
||||
if (ActivityBilling.isPro(context)) {
|
||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||
if (appWidgetManager == null) {
|
||||
Log.w("No app widget manager"); // Fairphone FP2
|
||||
return;
|
||||
}
|
||||
|
||||
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, WidgetUnified.class));
|
||||
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.lv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user