diff --git a/src/main/java/glslplugin/lang/parser/PreprocessorPsiBuilderAdapter.java b/src/main/java/glslplugin/lang/parser/PreprocessorPsiBuilderAdapter.java index 38642c3..aadc7e9 100755 --- a/src/main/java/glslplugin/lang/parser/PreprocessorPsiBuilderAdapter.java +++ b/src/main/java/glslplugin/lang/parser/PreprocessorPsiBuilderAdapter.java @@ -183,7 +183,7 @@ private void fillBufferIfEmpty() { for (ForeignLeafType type : redefinition.redefinedTo) { final int argumentIndex = arguments.indexOf(type.getValue()); - if (argumentIndex >= 0) { + if (argumentIndex >= 0 && argumentIndex < actualArguments.size()) { // Insert argument Collections.addAll(result, actualArguments.get(argumentIndex)); } else {