summaryrefslogtreecommitdiff
path: root/console_cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'console_cmds.c')
-rw-r--r--console_cmds.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/console_cmds.c b/console_cmds.c
index ab0364bfd..aea87fa40 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -609,10 +609,12 @@ DEF_CONSOLE_CMD(ConExec)
_script_running = true;
- fgets(cmd, sizeof(cmd), _script_file);
- while (!feof(_script_file) && _script_running) {
+ while (_script_running && fgets(cmd, sizeof(cmd), _script_file) != NULL) {
IConsoleCmdExec(cmd);
- fgets(cmd, sizeof(cmd), _script_file);
+ }
+
+ if (ferror(_script_file)) {
+ IConsoleError("Encountered errror while trying to read from script file");
}
_script_running = false;