Skip to content

Commit e135172

Browse files
authored
Merge pull request #38 from modothprav/hotfix
fix: index issue with cmd arguments
2 parents 4dbe19d + 52d8f39 commit e135172

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)