From 3604f3f69312aa7591356bc047ebf0cffec4bfc4 Mon Sep 17 00:00:00 2001 From: "Marios S. Kyriakou" Date: Thu, 1 Aug 2024 22:45:42 +0300 Subject: [PATCH] fix Co-Authored-By: Lew Rossman --- src/epanet.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) {