fix: fixed bug where too many wrong events would cause a null pointer

This commit is contained in:
Yannik Bretschneider 2021-07-20 23:48:32 +02:00
parent c060116d37
commit 48a378e75c

View File

@ -194,9 +194,9 @@ public class Lobby {
Optional<Participant> getParticipantForEntityType(EntityType type) { Optional<Participant> getParticipantForEntityType(EntityType type) {
if (type == EntityType.P1) { if (type == EntityType.P1) {
return Optional.of(connection.getPlayer1()); return Optional.ofNullable(connection.getPlayer1());
} else if (type == EntityType.P2) { } else if (type == EntityType.P2) {
return Optional.of(connection.getPlayer2()); return Optional.ofNullable(connection.getPlayer2());
} else { } else {
return Optional.empty(); return Optional.empty();
} }