Adjust default pattern index after a pattern is deleted

This commit is contained in:
Lew Rossman
2022-01-14 09:09:32 -05:00
parent afda609223
commit 14de37d0cb

View File

@@ -4387,6 +4387,10 @@ int DLLEXPORT EN_deletepattern(EN_Project p, int index)
if (hyd->Epat == index) hyd->Epat = 0;
else if (hyd->Epat > index) hyd->Epat--;
// Modify global default demand pattern
if (hyd->DefPat == index) hyd->DefPat = 0;
else if (hyd->DefPat > index) hyd->DefPat--;
// Free the pattern's factor array
FREE(net->Pattern[index].F);
FREE(net->Pattern[index].Comment);