浏览代码

Fix crash when disabling airplane mode

Fixes #11096

Signed-off-by: Chris Narkiewicz <hello@ezaquarii.com>
Chris Narkiewicz 2 年之前
父节点
当前提交
45567fb6d4
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      app/src/main/java/com/nextcloud/client/widget/DashboardWidgetService.kt

+ 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")
                 }