diff --git a/src/main/java/com/laytonsmith/core/functions/StringHandling.java b/src/main/java/com/laytonsmith/core/functions/StringHandling.java index 46c8f19a8..612f8f2aa 100644 --- a/src/main/java/com/laytonsmith/core/functions/StringHandling.java +++ b/src/main/java/com/laytonsmith/core/functions/StringHandling.java @@ -1434,15 +1434,16 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi } } - if(requiredArgs(parsed) != flattenedArgs.size()) { + int requiredArgs = requiredArgs(parsed); + if(requiredArgs != flattenedArgs.size()) { throw new CREInsufficientArgumentsException("The specified format string: \"" + formatString + "\"" - + " expects " + requiredArgs(parsed) + " argument(s)," + + " expects " + requiredArgs + " argument(s)," + " but " + flattenedArgs.size() + " were provided.", t); } //Now figure out how to cast things, now that we know our argument numbers will match up Object[] params = new Object[flattenedArgs.size()]; - for(int i = 0; i < requiredArgs(parsed); i++) { + for(int i = 0; i < requiredArgs; i++) { Mixed arg = flattenedArgs.get(i); FormatString fs = parsed.get(i); Character c = fs.getExpectedType();