Skip to content

Commit

Permalink
inner-2062: fix npe
Browse files Browse the repository at this point in the history
Signed-off-by: dcy10000 <[email protected]>
  • Loading branch information
dcy10000 committed Dec 27, 2022
1 parent 59e8fce commit 8fa8ff8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void parseErrorPacket(byte[] data, String reason) {
@Override
protected void handleInnerData(byte[] data) {
if (connection.isClosed()) {
if (data.length > 4 && data[4] == ErrorPacket.FIELD_COUNT) {
if (data != null && data.length > 4 && data[4] == ErrorPacket.FIELD_COUNT) {
parseErrorPacket(data, "connection close");
}
return;
Expand Down Expand Up @@ -241,11 +241,11 @@ protected void handleDataError(Exception e) {
}

private void clearTaskQueue() {
while (!taskQueue.isEmpty()) {
final ServiceTask task = taskQueue.poll();
ServiceTask task;
while ((task = taskQueue.poll()) != null) {
if (task.getType() == ServiceTaskType.NORMAL) {
final byte[] data = ((NormalServiceTask) task).getOrgData();
if (data.length > 4 && data[4] == ErrorPacket.FIELD_COUNT) {
if (data != null && data.length > 4 && data[4] == ErrorPacket.FIELD_COUNT) {
parseErrorPacket(data, "cleanup");
}
}
Expand Down

0 comments on commit 8fa8ff8

Please sign in to comment.