Skip to content

Commit 4dbe19d

Browse files
authored
Merge pull request #37 from modothprav/hotfix
fix: accounts for invalid arguments
2 parents 80ab9ab + ca97181 commit 4dbe19d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/FileEncryptor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public static void main(String[] args) throws Exception {
124124

125125
// Check if password and/or file paths have been specified
126126
if (argIndex + 2 >= charArgs.length) { throw new IllegalArgumentException("Not enough arguments specified" + ERROR_MSG); }
127+
if (argIndex + 2 <= charArgs.length) { throw new IllegalArgumentException("Invalid arguments please refer to instructions" + ERROR_MSG); }
127128

128129
encrypt(charArgs[argIndex], new String(charArgs[argIndex + 1]), new String(charArgs[argIndex + 2]));
129130

0 commit comments

Comments
 (0)