Skip to content

Commit d212ea8

Browse files
gselzerctrueden
authored andcommitted
Prevent ArrayIndexException in typeVar inference
1 parent 69a8f05 commit d212ea8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/main/java/org/scijava/ops/matcher/MatchingUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,10 @@ private static void inferTypeVariables(Type[] types, Type[] inferFrom, Map<TypeV
429429
throws TypeInferenceException {
430430
if (typeAssigns == null)
431431
throw new IllegalArgumentException();
432+
// TODO: is this the correct place to put this? We could get a marginal increase
433+
// in Type Variable information if we put this farther into the loop.
434+
if (types.length != inferFrom.length)
435+
throw new TypeInferenceException();
432436
// Check all pairs of types
433437
for (int i = 0; i < types.length; i++) {
434438
if (types[i] instanceof TypeVariable) {

0 commit comments

Comments
 (0)