From 6d2384448336c1b55e335cd0cc8b01085fbaaf99 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 27 Oct 2023 10:35:27 -0400 Subject: [PATCH] Corrected an error in the flattening routine that will cause the "flatten" command to crash if there are black-box subcircuits in the netlist. --- base/flatten.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/base/flatten.c b/base/flatten.c index a42e03c..3742931 100644 --- a/base/flatten.c +++ b/base/flatten.c @@ -136,17 +136,16 @@ void flattenCell(char *name, int file) ob2 = ob2->next; } - /* delete all port elements from child */ while (IsPort(ChildObjList)) { /* delete all ports at beginning of list */ if (Debug) Printf("deleting leading port from child\n"); tmp = ChildObjList->next; FreeObjectAndHash(ChildObjList, ChildCell); - ChildObjList = tmp; + if ((ChildObjList = tmp) == NULL) break; } tmp = ChildObjList; - while (tmp->next != NULL) { + while (tmp && (tmp->next != NULL)) { if (IsPort(tmp->next)) { ob2 = (tmp->next)->next; if (Debug) Printf("deleting a port from child\n");