exit if user refuses to choose a nickname

pull/34/head
Zlatin Balevsky 2019-11-28 16:39:38 +00:00
parent 4c038ad932
commit 7a0c60a164
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,11 @@ class Ready extends AbstractLifecycleHandler {
nickname = JOptionPane.showInputDialog(null, nickname = JOptionPane.showInputDialog(null,
"Your nickname is displayed when you send search results so other MuWire users can choose to trust you", "Your nickname is displayed when you send search results so other MuWire users can choose to trust you",
"Please choose a nickname", JOptionPane.PLAIN_MESSAGE) "Please choose a nickname", JOptionPane.PLAIN_MESSAGE)
if (nickname == null || nickname.trim().length() == 0) { if (nickname == null) {
JOptionPane.showMessageDialog(null, "MuWire cannot start without a nickname and will now exit", JOptionPane.PLAIN_MESSAGE)
System.exit(0)
}
if (nickname.trim().length() == 0) {
JOptionPane.showMessageDialog(null, "Nickname cannot be empty", "Select another nickname", JOptionPane.showMessageDialog(null, "Nickname cannot be empty", "Select another nickname",
JOptionPane.WARNING_MESSAGE) JOptionPane.WARNING_MESSAGE)
continue continue