Merge pull request 'Исправление ошибки NPE при несуществующем пакете' (#4) from main into dev
Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
@@ -116,6 +116,13 @@ public class Server extends WebSocketServer {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
PacketExecutor executor = this.packetManager.getExecutors().get(packetId);
|
PacketExecutor executor = this.packetManager.getExecutors().get(packetId);
|
||||||
|
if(executor == null){
|
||||||
|
/**
|
||||||
|
* Нет назначенного обработчика для этого packetId
|
||||||
|
*/
|
||||||
|
client.disconnect(ServerFailures.UNSUPPORTED_PACKET);
|
||||||
|
return;
|
||||||
|
}
|
||||||
executor.settings = this.settings;
|
executor.settings = this.settings;
|
||||||
if(listener != null && !listener.onPacketReceived(this, client, packet)) {
|
if(listener != null && !listener.onPacketReceived(this, client, packet)) {
|
||||||
/**
|
/**
|
||||||
@@ -143,7 +150,7 @@ public class Server extends WebSocketServer {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
//client.disconnect(ServerFailures.UNSUPPORTED_PACKET);
|
//client.disconnect(ServerFailures.BAD_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user