Browse Source

Merge pull request #11113 from nextcloud/fix-crash-when-disabling-airplane-mode

Fix crash when disabling airplane mode
Álvaro Brey 2 years ago
parent
commit
5d4b7a6d04

+ 8 - 6
app/src/main/java/com/nextcloud/client/widget/DashboardWidgetService.kt

@@ -112,12 +112,14 @@ class StackRemoteViewsFactory(
             try {
                 if (widgetConfiguration.user.isPresent) {
                     val client = clientFactory.createNextcloudClient(widgetConfiguration.user.get())
-                    val result =
-                        DashboardGetWidgetItemsRemoteOperation(widgetConfiguration.widgetId, LIMIT_SIZE).execute(client)
-                    widgetItems = result.resultData[widgetConfiguration.widgetId] ?: emptyList()
-
-                    hasLoadMore = widgetConfiguration.moreButton != null &&
-                        widgetItems.size == LIMIT_SIZE
+                    val result = DashboardGetWidgetItemsRemoteOperation(widgetConfiguration.widgetId, LIMIT_SIZE)
+                        .execute(client)
+                    widgetItems = if (result.isSuccess) {
+                        result.resultData[widgetConfiguration.widgetId] ?: emptyList()
+                    } else {
+                        emptyList()
+                    }
+                    hasLoadMore = widgetConfiguration.moreButton != null && widgetItems.size == LIMIT_SIZE
                 } else {
                     Log_OC.w(TAG, "User not present for widget update")
                 }