Эх сурвалжийг харах

Crashing bug fixes

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 жил өмнө
parent
commit
60d329b8b1

+ 11 - 5
app/src/main/java/com/nextcloud/talk/components/filebrowser/controllers/BrowserController.java

@@ -228,7 +228,9 @@ public class BrowserController extends BaseController implements ListingInterfac
 
             currentPath = objectList.get(0).getPath();
 
-            Objects.requireNonNull(getActivity()).runOnUiThread(this::setTitle);
+            if (getActivity() != null) {
+                getActivity().runOnUiThread(() -> setTitle());
+            }
 
             for (int i = 1; i < objectList.size(); i++) {
                 fileBrowserItems.add(new BrowserFileItem(objectList.get(i), activeUser, this));
@@ -236,10 +238,14 @@ public class BrowserController extends BaseController implements ListingInterfac
         }
 
         adapter.addItems(0, fileBrowserItems);
-        Objects.requireNonNull(getActivity()).runOnUiThread(() -> {
-            adapter.notifyDataSetChanged();
-            changeEnabledStatusForBarItems(true);
-        });
+
+        if (getActivity() != null) {
+            getActivity().runOnUiThread(() -> {
+                adapter.notifyDataSetChanged();
+                changeEnabledStatusForBarItems(true);
+
+            });
+        }
     }
 
     private boolean shouldPathBeSelectedDueToParent(String currentPath) {

+ 7 - 3
app/src/main/java/com/nextcloud/talk/controllers/ChatController.java

@@ -1019,15 +1019,19 @@ public class ChatController extends BaseController implements MessagesListAdapte
                         newMessagesCount = 0;
                     }
 
-                    chatMessage.setGrouped(adapter.isPreviousSameAuthor(chatMessage.getActorId(), -1) && (adapter.getSameAuthorLastMessagesCount(chatMessage.getActorId()) % 5) > 0);
+                    if (adapter != null) {
+                        chatMessage.setGrouped(adapter.isPreviousSameAuthor(chatMessage.getActorId(), -1) && (adapter.getSameAuthorLastMessagesCount(chatMessage.getActorId()) % 5) > 0);
+                        adapter.addToStart(chatMessage, shouldScroll);
+                    }
 
-                    adapter.addToStart(chatMessage, shouldScroll);
                 }
 
                 String xChatLastGivenHeader;
                 if (response.headers().size() > 0 && !TextUtils.isEmpty((xChatLastGivenHeader = response.headers().get
                         ("X-Chat-Last-Given")))) {
-                    globalLastKnownFutureMessageId = Integer.parseInt(xChatLastGivenHeader);
+                    if (xChatLastGivenHeader != null) {
+                        globalLastKnownFutureMessageId = Integer.parseInt(xChatLastGivenHeader);
+                    }
                 }
             }