Wrapped printToGUI method contents in try-catch block, in case the fx components haven't been initialized yet

This commit is contained in:
Seraina 2022-04-30 13:16:05 +02:00
parent 1fd1cb6033
commit a6e412f552

View File

@ -317,6 +317,7 @@ public class Client {
*TODO(Seraina&Sebi): evtl. auslagern? *TODO(Seraina&Sebi): evtl. auslagern?
*/ */
public void sendToGUI(String parameter, String data) { public void sendToGUI(String parameter, String data) {
try {
switch (parameter) { switch (parameter) {
case ClientGameInfoHandler.itsNightTime: //ClientGameInfoHandler case ClientGameInfoHandler.itsNightTime: //ClientGameInfoHandler
gameStateModel.setDayClone(false); gameStateModel.setDayClone(false);
@ -341,8 +342,11 @@ public class Client {
case GuiParameters.listOfPLayers: case GuiParameters.listOfPLayers:
break; break;
default: default:
gameController.addMessageToNotificationText(data); //TODO(Sebi,Seraina): should the gameController be in the Application just like the ChatController? gameController.addMessageToNotificationText(
data); //TODO(Sebi,Seraina): should the gameController be in the Application just like the ChatController?
}
} catch (Exception e) {
LOGGER.warn("Communication with GUI currently not possible: " + e.getMessage());
} }