Update epanet.c
Trying to isolate bug
@@ -2861,22 +2861,18 @@ int DLLEXPORT EN_getdemandname(EN_Project p, int nodeIndex, int demandIndex,
// Locate demand category record and retrieve its name
list_t *dlist = p->network.Node[nodeIndex].D;
+ if (dlist) {
list_node_t *lnode = get_nth_list(dlist, demandIndex);
if (!lnode)
return 253;
else
temp = get_category_name(lnode);
- //for (d = p->network.Node[nodeIndex].D;
- // n < demandIndex && d->next != NULL; d = d->next) n++;
- //if (n != demandIndex) return 253;
-
if (temp) {
strcpy(demandName, temp);
- //else demandName[0] = '\0';
free(temp);
}
-
+ }
return 0;
}
