diff options
author | Arisotura <thetotalworm@gmail.com> | 2021-05-03 17:02:38 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2021-05-03 17:02:38 +0200 |
commit | b7d5a7db7508dba1e1e5f527accf0dadc84efb21 (patch) | |
tree | 96a3b6b6e46f6581fcda02a569558d550cc29fe4 /src | |
parent | 41cd092a15b3dbb9c3118124537e0481dfbaddc7 (diff) |
don't attempt to parse lines that failed to fetch
Diffstat (limited to 'src')
-rw-r--r-- | src/ARCodeFile.cpp | 4 | ||||
-rw-r--r-- | src/Config.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/ARCodeFile.cpp b/src/ARCodeFile.cpp index 2510b6e..e7780b7 100644 --- a/src/ARCodeFile.cpp +++ b/src/ARCodeFile.cpp @@ -60,8 +60,8 @@ bool ARCodeFile::Load() char linebuf[1024]; while (!feof(f)) { - if (fgets(linebuf, 1024, f) == NULL) - printf("Error reading string from file!"); + if (fgets(linebuf, 1024, f) == nullptr) + break; linebuf[1023] = '\0'; diff --git a/src/Config.cpp b/src/Config.cpp index 3fb2b26..b39abd0 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -119,8 +119,8 @@ void Load() char entryval[1024]; while (!feof(f)) { - if (fgets(linebuf, 1024, f) == NULL) - printf("Error reading string from file!"); + if (fgets(linebuf, 1024, f) == nullptr) + break; int ret = sscanf(linebuf, "%31[A-Za-z_0-9]=%[^\t\r\n]", entryname, entryval); entryname[31] = '\0'; |