Corrected rare case where a cell that is flattened is the first

instance in a cell, and is empty, and causes the cell contents
to be nulled out.
This commit is contained in:
Tim Edwards 2017-05-08 20:55:58 -04:00
parent ace1c28507
commit ccdd47bc0b
1 changed files with 21 additions and 15 deletions

View File

@ -486,6 +486,11 @@ int flattenInstancesOf(char *name, int fnum, char *instance)
} }
/* splice instance out of parent */ /* splice instance out of parent */
if ((ParentParams == ThisCell->cell) && (ChildObjList == NULL)) {
ThisCell->cell = ob2; /* Child cell was empty */
tmp = ob2;
}
else {
if (ParentParams == ThisCell->cell) { if (ParentParams == ThisCell->cell) {
/* ParentParams are the very first thing in the list */ /* ParentParams are the very first thing in the list */
ThisCell->cell = ChildObjList; ThisCell->cell = ChildObjList;
@ -504,6 +509,7 @@ int flattenInstancesOf(char *name, int fnum, char *instance)
tmp = tmp->next; tmp = tmp->next;
} while ((tmp != NULL) && ((tmp->type > FIRSTPIN) || (tmp->type == PROPERTY))); } while ((tmp != NULL) && ((tmp->type > FIRSTPIN) || (tmp->type == PROPERTY)));
if (ob2) ob2->next = tmp; if (ob2) ob2->next = tmp;
}
while (ParentParams != tmp) { while (ParentParams != tmp) {
ob2 = ParentParams->next; ob2 = ParentParams->next;
FreeObjectAndHash(ParentParams, ThisCell); FreeObjectAndHash(ParentParams, ThisCell);