Crashing bug fixes

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-04-28 13:46:40 +02:00
parent 60d19bc658
commit 60d329b8b1
2 changed files with 18 additions and 8 deletions

View File

@ -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) {

View File

@ -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);
}
}
}