From 1382c24893456ce9df3ccae2f70692559edc319e Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Fri, 2 Aug 2024 10:53:34 +0200 Subject: [PATCH] fix: Prevent a NPE Both noAccountView() and onAccountAvailable() methods can return early, ending up in a RemoteViews not instanciated. --- .../main/java/foundation/e/drive/widgets/EDriveWidget.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java b/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java index d5891220..0e9558b4 100644 --- a/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java +++ b/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java @@ -128,7 +128,10 @@ public class EDriveWidget extends AppWidgetProvider { } else { onAccountAvailable(context, accountManager); } - appWidgetManager.updateAppWidget(appWidgetId, views); + + if (views != null) { + appWidgetManager.updateAppWidget(appWidgetId, views); + } } private boolean isAccountPresentInApp(@NonNull Context context) { -- GitLab