Skip to content

Commit

Permalink
fix(tcpSocket): move if null
Browse files Browse the repository at this point in the history
  • Loading branch information
cc-steina committed Jun 17, 2022
1 parent 70c00dd commit 1a5169e
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -88,19 +88,19 @@ public void startListening() {
* @param data data to be sent
*/
public void write(final int msgId, final byte[] data) {
if (socket != null) {
writeExecutor.execute(new Runnable() {
@Override
public void run() {
try {
socket.getOutputStream().write(data);
receiverListener.onWritten(getId(), msgId, null);
writeExecutor.execute(new Runnable() {
@Override
public void run() {
try {
if (socket != null) {
socket.getOutputStream().write(data);
receiverListener.onWritten(getId(), msgId, null);
});
} catch (IOException e) {
receiverListener.onWritten(getId(), msgId, e.toString());
receiverListener.onError(getId(), e.toString());
}
}
});
}
}

Expand Down

0 comments on commit 1a5169e

Please sign in to comment.