fix: fixed bug where too many wrong events would cause a null pointer
This commit is contained in:
parent
c060116d37
commit
48a378e75c
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user