Skip to content

Commit

Permalink
verifica range 1...NMAX
Browse files Browse the repository at this point in the history
  • Loading branch information
fulcorno committed Mar 13, 2018
1 parent 8d91242 commit 9675fc1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/it/polito/tdp/indonumero/IndoNumeroController.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ void handleProva(ActionEvent event) {
try {
int num = Integer.parseInt(numS) ;
// numero era effettivamente un intero

if(num<1 || num>NMAX) {
txtLog.appendText("Valore fuori dall'intervallo consentito\n");
return ;
}

if(num==this.segreto) {
// ha indovinato
txtLog.appendText("Hai vinto!\n");
Expand Down

0 comments on commit 9675fc1

Please sign in to comment.