From 00ac549750627460f76c5658296d67e5e60d13dd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 8 Jan 2020 20:57:29 +0100 Subject: [PATCH] idiot-proofing the newfactions file parser --- src/gmtool.c | 2 +- src/modules/autoseed.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gmtool.c b/src/gmtool.c index d876b22bd..394f1efde 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -47,7 +47,7 @@ static int g_quit; int force_color = 0; -newfaction * new_players = 0; +newfaction * new_players = NULL; state *current_state = NULL; diff --git a/src/modules/autoseed.c b/src/modules/autoseed.c index fca838c2a..b74690745 100644 --- a/src/modules/autoseed.c +++ b/src/modules/autoseed.c @@ -87,17 +87,17 @@ newfaction *read_newfactions(const char *filename) if (fgets(buf, sizeof(buf), F) == NULL) break; + if (buf[0] == '#') { + continue; + } email[0] = '\0'; password[0] = '\0'; - if (sscanf(buf, "%54s %19s %7s %15s %4d", email, race, lang, + if (sscanf(buf, "%54s %19s %7s %15s %4d", email, race, lang, password, &alliance) < 3) { break; } - if (email[0] == '#') { - continue; - } if (email[0] == '\0') { break; }