Исправление ошибки NPE при несуществующем пакете
Some checks failed
Build rosetta-wss / build (push) Has been cancelled

This commit is contained in:
2026-02-20 23:16:49 +02:00
parent a740080218
commit cf9d1f2994

View File

@@ -116,6 +116,13 @@ public class Server extends WebSocketServer {
*/
@SuppressWarnings("rawtypes")
PacketExecutor executor = this.packetManager.getExecutors().get(packetId);
if(executor == null){
/**
* Нет назначенного обработчика для этого packetId
*/
client.disconnect(ServerFailures.UNSUPPORTED_PACKET);
return;
}
executor.settings = this.settings;
if(listener != null && !listener.onPacketReceived(this, client, packet)) {
/**
@@ -143,7 +150,7 @@ public class Server extends WebSocketServer {
}
} catch (Exception e) {
e.printStackTrace();
//client.disconnect(ServerFailures.UNSUPPORTED_PACKET);
//client.disconnect(ServerFailures.BAD_PACKET);
}
}