From 74963229c1069ccef61336e6ae61b215b7d30b00 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 14 Oct 2026 13:56:15 +0200 Subject: [PATCH] addfilelocal/autoload: fix showing wrong error when file was not found W_CheckFileContains returns -1 if file was not found which still triggered those conditions so just handle if file was not found to skip doing other stuff in those cases --- src/d_main.c | 10 ++++++++-- src/p_setup.c | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 14900aa29..53897bf56 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1260,13 +1260,19 @@ static void D_FindAddonsToAutoload(void) // ok so theres still issues with players adding stuff to autoload by accident // sometimes this stuff contains maps // you can probably imagine how that goes in a netgame.... - if (W_CheckAutoLoadContainsMap(wadsToAutoload)) + int retmap = W_CheckAutoLoadContainsMap(wadsToAutoload); + if (retmap == -1) + { + CONS_Alert(CONS_WARNING, "Autoload: file %s was not found or not valid.\n", wadsToAutoload); + continue; + } + if (retmap > 0) { CONS_Alert(CONS_WARNING, "Autoload: file %s contains map data, this WILL cause crashes and desynchs! skipping...\n", wadsToAutoload); continue; } - if (!postload && W_CheckPostLoadList(wadsToAutoload)) + if (!postload && W_CheckPostLoadList(wadsToAutoload) > 0) { CONS_Printf("Autoload: forcing postload for file %s\n", wadsToAutoload); postload = true; diff --git a/src/p_setup.c b/src/p_setup.c index 108fe396f..887f5e2f0 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3433,7 +3433,13 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local) { // check if someone tries to load maps locally lol // do this here so we can skip loading the file anyways - if (W_CheckAutoLoadContainsMap(wadfilename)) + int retmap = W_CheckAutoLoadContainsMap(wadfilename); + if (retmap == -1) + { + CONS_Alert(CONS_WARNING, "addilelocal: file %s was not found or not valid.\n", wadfilename); + return UINT16_MAX; + } + if (retmap > 0) { CONS_Alert(CONS_WARNING, "addilelocal: locally added file %s contains map data, this WILL cause crashes and desynchs! not added.\n", wadfilename); return UINT16_MAX;