mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Various bug fixes
- Fixed bug where an invalid port number would crash the program - Closed the stage before cleaning up resources. This speeds up closing the app. - Added error handling for when the client looses connection to the server. Tags: #story[1281]
This commit is contained in:
@@ -272,6 +272,8 @@ public class ViewManager {
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (stage!= null) stage.close();
|
||||
|
||||
try {
|
||||
ServerAdvertiser.getInstance().unregister();
|
||||
} catch (IOException e1) {
|
||||
|
||||
@@ -50,6 +50,15 @@ public class DirectConnectController implements Initializable {
|
||||
*/
|
||||
private void connectToServer() {
|
||||
//TODO fix port number validation
|
||||
|
||||
try{
|
||||
Integer.parseInt(portNumber.getText());
|
||||
}
|
||||
catch (NumberFormatException e){
|
||||
ViewManager.getInstance().showErrorSnackBar("You need to enter a valid port number");
|
||||
return;
|
||||
}
|
||||
|
||||
ViewManager.getInstance().getGameClient()
|
||||
.runAsClient(serverAddress.getText(), Integer.parseInt(portNumber.getText()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user