commit 766ac5bd0cb2d1afc459e82632fba61eaf98e340
parent 9421b99f96c4192441053882a263640bf72e4bd0
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date: Mon, 25 Nov 2019 17:32:58 +0100
Throw error if selection is invalid
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/servertask.java b/servertask.java
@@ -150,8 +150,7 @@ public class servertask implements Runnable {
String message = inputStr.readUTF();
int val = 0;
while (message.compareTo("q") != 0) { // use 'q' to quit
- if (util.isNumeric(message)) {
- val = Integer.parseInt(message);
+ if (util.isNumeric(message) && (val = Integer.parseInt(message)) > 0 && val < 3) {
if (val == 1 && loggedin == 0) {
System.out.println("in 1");
outputStr.writeUTF("Enter your username and password" +