Skip to content

Commit

Permalink
Fix a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
c99koder committed Jul 9, 2019
1 parent 28a4a7b commit d7e2c2d
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions src/com/irccloud/android/fragment/BuffersListFragment.java
Expand Up @@ -289,38 +289,41 @@ public void run() {
}

if (e.isConsole()) {
ObjectNode fail_info = ServersList.getInstance().getServer(e.getCid()).getFail_info();

if (fail_info != null && fail_info.has("type")) {
if (firstFailurePosition == -1 || firstFailurePosition > pos)
firstFailurePosition = pos;
if (lastFailurePosition == -1 || lastFailurePosition < pos)
lastFailurePosition = pos;
} else {
if (firstFailurePosition == pos) {
firstFailurePosition = -1;
for (int i = 0; i < data.size(); i++) {
Buffer j = data.get(i);
Server s = j.getServer();
if(j.isConsole() && s != null) {
fail_info = s.getFail_info();
if (fail_info != null && fail_info.has("type")) {
firstFailurePosition = i;
break;
Server s = ServersList.getInstance().getServer(e.getCid());
if (s != null) {
ObjectNode fail_info = s.getFail_info();

if (fail_info != null && fail_info.has("type")) {
if (firstFailurePosition == -1 || firstFailurePosition > pos)
firstFailurePosition = pos;
if (lastFailurePosition == -1 || lastFailurePosition < pos)
lastFailurePosition = pos;
} else {
if (firstFailurePosition == pos) {
firstFailurePosition = -1;
for (int i = 0; i < data.size(); i++) {
Buffer j = data.get(i);
s = j.getServer();
if (j.isConsole() && s != null) {
fail_info = s.getFail_info();
if (fail_info != null && fail_info.has("type")) {
firstFailurePosition = i;
break;
}
}
}
}
}
if (lastFailurePosition == pos) {
lastFailurePosition = -1;
for (int i = pos; i >= 0; i--) {
Buffer j = data.get(i);
Server s = j.getServer();
if(j.isConsole() && s != null) {
fail_info = s.getFail_info();
if (fail_info != null && fail_info.has("type")) {
lastFailurePosition = i;
break;
if (lastFailurePosition == pos) {
lastFailurePosition = -1;
for (int i = pos; i >= 0; i--) {
Buffer j = data.get(i);
s = j.getServer();
if (j.isConsole() && s != null) {
fail_info = s.getFail_info();
if (fail_info != null && fail_info.has("type")) {
lastFailurePosition = i;
break;
}
}
}
}
Expand Down

0 comments on commit d7e2c2d

Please sign in to comment.