Skip to content

Commit

Permalink
fix for a crash when mTopicName is null
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Jun 3, 2021
1 parent 055f8b5 commit 1239e76
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/src/main/java/co/tinode/tindroid/MessagesFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public void afterTextChanged(Editable editable) {
// Not a progress report, just a status change.
break;
}
if (!mTopicName.equals(topicName)) {
if (!topicName.equals(mTopicName)) {
break;
}
long progress = data.getLong(AttachmentHandler.ARG_PROGRESS, -1);
Expand All @@ -298,8 +298,11 @@ public void afterTextChanged(Editable editable) {
case SUCCEEDED: {
Data result = wi.getOutputData();
String topicName = result.getString(AttachmentHandler.ARG_TOPIC_NAME);
if (topicName == null) {
break;
}
long msgId = result.getLong(AttachmentHandler.ARG_MSG_ID, -1L);
if (msgId > 0 && mTopicName.equals(topicName)) {
if (msgId > 0 && topicName.equals(mTopicName)) {
activity.syncMessages(msgId, true);
}
break;
Expand All @@ -314,7 +317,10 @@ public void afterTextChanged(Editable editable) {
case FAILED: {
Data failure = wi.getOutputData();
String topicName = failure.getString(AttachmentHandler.ARG_TOPIC_NAME);
if (mTopicName.equals(topicName)) {
if (topicName == null) {
break;
}
if (topicName.equals(mTopicName)) {
long msgId = failure.getLong(AttachmentHandler.ARG_MSG_ID, -1L);
if (BaseDb.getInstance().getStore().getMessageById(msgId) != null) {
runMessagesLoader(mTopicName);
Expand Down

0 comments on commit 1239e76

Please sign in to comment.