Skip to content

Commit 52d8f39

Browse files
committed
fix: index issue with cmd arguments
1 parent 4dbe19d commit 52d8f39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/FileEncryptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +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); }
127+
if (argIndex + 2 < charArgs.length - 1) { throw new IllegalArgumentException("Invalid arguments please refer to instructions" + ERROR_MSG); }
128128

129129
encrypt(charArgs[argIndex], new String(charArgs[argIndex + 1]), new String(charArgs[argIndex + 2]));
130130

0 commit comments

Comments
 (0)