diff --git a/src/epanet.c b/src/epanet.c index 16e7bf6f..71cad747 100644 --- a/src/epanet.c +++ b/src/epanet.c @@ -4526,6 +4526,7 @@ int DLLEXPORT EN_loadpatternfile(EN_Project p, const char *filename, const char { FILE *file; char line[MAXLINE+1]; + char *tok; int err = 0; int i; int len = 0; @@ -4552,7 +4553,9 @@ int DLLEXPORT EN_loadpatternfile(EN_Project p, const char *filename, const char while (fgets(line, sizeof(line), file) != NULL) { // Skip lines that don't contain valid numbers - if (!getfloat(line, &value)) continue; + tok = strtok(line, SEPSTR); + if (tok == NULL) continue; + if (!getfloat(tok, &value)) continue; // Resize multiplier array if it's full if (len % CHUNK == 0) {