From 48a378e75c1a0d81d427997b433fef432fc06233 Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Tue, 20 Jul 2021 23:48:32 +0200 Subject: [PATCH] fix: fixed bug where too many wrong events would cause a null pointer --- .../main/java/uulm/teamname/marvelous/server/lobby/Lobby.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/Lobby.java b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/Lobby.java index 3d6e5be..c0498d7 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/Lobby.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/Lobby.java @@ -194,9 +194,9 @@ public class Lobby { Optional getParticipantForEntityType(EntityType type) { if (type == EntityType.P1) { - return Optional.of(connection.getPlayer1()); + return Optional.ofNullable(connection.getPlayer1()); } else if (type == EntityType.P2) { - return Optional.of(connection.getPlayer2()); + return Optional.ofNullable(connection.getPlayer2()); } else { return Optional.empty(); }