mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 03:11:08 +01:00
Merge pull request #2578 from kfeuz/Issue2577
Fixes NPE when writing to disconnected client, Issue #2577
This commit is contained in:
@@ -310,8 +310,8 @@ public class Server implements Runnable {
|
||||
public void write(int data) { // will also cover char
|
||||
int index = 0;
|
||||
while (index < clientCount) {
|
||||
clients[index].write(data);
|
||||
if (clients[index].active()) {
|
||||
clients[index].write(data);
|
||||
index++;
|
||||
} else {
|
||||
removeIndex(index);
|
||||
@@ -323,8 +323,8 @@ public class Server implements Runnable {
|
||||
public void write(byte data[]) {
|
||||
int index = 0;
|
||||
while (index < clientCount) {
|
||||
clients[index].write(data);
|
||||
if (clients[index].active()) {
|
||||
clients[index].write(data);
|
||||
index++;
|
||||
} else {
|
||||
removeIndex(index);
|
||||
@@ -336,8 +336,8 @@ public class Server implements Runnable {
|
||||
public void write(String data) {
|
||||
int index = 0;
|
||||
while (index < clientCount) {
|
||||
clients[index].write(data);
|
||||
if (clients[index].active()) {
|
||||
clients[index].write(data);
|
||||
index++;
|
||||
} else {
|
||||
removeIndex(index);
|
||||
|
||||
Reference in New Issue
Block a user