Skip to content

Commit

Permalink
Merge pull request #88 from unlimmitted/master
Browse files Browse the repository at this point in the history
Fix NullPointerException
  • Loading branch information
GideonLeGrange authored Sep 26, 2024
2 parents 75a140f + bfbe507 commit ed0468d
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/main/java/me/legrange/mikrotik/impl/ApiConnectionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,20 +255,24 @@ public void run() {
} catch (MikrotikApiException ex) {
continue;
}
ResultListener l = listeners.get(res.getTag());
if (l != null) {
if (res instanceof Result) {
l.receive((Result) res);
} else if (res instanceof Done) {
if (l instanceof SyncListener) {
((SyncListener) l).completed((Done) res);
} else {
l.completed();
if (res.getTag() != null) {
ResultListener l = listeners.get(res.getTag());
if (l != null) {
if (res instanceof Result) {
l.receive((Result) res);
} else if (res instanceof Done) {
if (l instanceof SyncListener) {
((SyncListener) l).completed((Done) res);
} else {
l.completed();
}
listeners.remove(res.getTag());
} else if (res instanceof Error) {
l.error(new ApiCommandException((Error) res));
}
listeners.remove(res.getTag());
} else if (res instanceof Error) {
l.error(new ApiCommandException((Error) res));
}
} else {
nextTag();
}
}
}
Expand Down

0 comments on commit ed0468d

Please sign in to comment.