Skip to content

Commit

Permalink
fix: check arguments size before calling get
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel committed Jul 4, 2023
1 parent 0cf2e19 commit 58ac534
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ public static Optional<TypeRef> getMapValueType(TypeRef mapType) {
}

private static Optional<TypeRef> extractArgument(TypeRef type, TypeCast typeCast, int index) {
return typeCast.apply(type).map(castType -> castType.getArguments().get(index));
return typeCast.apply(type)
.filter(castType -> castType.getArguments() != null && castType.getArguments().size() > index)
.map(castType -> castType.getArguments().get(index));
}

/**
Expand Down

0 comments on commit 58ac534

Please sign in to comment.