diff --git a/org.lflang/src/org/lflang/ASTUtils.java b/org.lflang/src/org/lflang/ASTUtils.java index a989a99f03..6f8ca4dbfa 100644 --- a/org.lflang/src/org/lflang/ASTUtils.java +++ b/org.lflang/src/org/lflang/ASTUtils.java @@ -1451,7 +1451,12 @@ public static int width(WidthSpec spec, List instantiations) { // If the width cannot be determined because term's width <= 0, which means the term's width // must be inferred, try to infer the width using connections. if (spec.eContainer() instanceof Instantiation) { - return inferWidthFromConnections(spec, instantiations); + try { + return inferWidthFromConnections(spec, instantiations); + } catch (InvalidSourceException e) { + // If the inference fails, return -1. + return -1; + } } } }