Skip to content

Commit

Permalink
Add check for integer when -d is used
Browse files Browse the repository at this point in the history
Make sure that the difficulty parameter is an integer.
  • Loading branch information
Mithil467 committed Mar 22, 2020
1 parent 0d6ad86 commit 7d23f88
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mitype/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,11 @@ def parse(self):
print("Cannot open file -", args[0])
sys.exit(0)
elif "-d" in opts:
limit = int(args[0])
try:
limit = int(args[0])
except:
print("Expected an integer")
sys.exit(0)
if limit not in range(1, 6):
print("Please enter a difficulty level between 1 and 5")
sys.exit(0)
Expand Down

0 comments on commit 7d23f88

Please sign in to comment.