Skip to content

Commit

Permalink
fix(Android): Fix null error writing on disconnected socket
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapsssito committed Nov 21, 2022
1 parent 7527e90 commit 59d3195
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public void write(final int msgId, final byte[] data) {
writeExecutor.execute(new Runnable() {
@Override
public void run() {
if (socket == null) {
receiverListener.onError(getId(), new IOException("Attempted to write to closed socket"));
return;
}
try {
socket.getOutputStream().write(data);
receiverListener.onWritten(getId(), msgId, null);
Expand Down

0 comments on commit 59d3195

Please sign in to comment.