From ee4efc778cc4aee6215a25017148b6f6bc25842a Mon Sep 17 00:00:00 2001 From: Diavolo Date: Mon, 20 Feb 2023 16:44:45 +0100 Subject: [PATCH] fix: general moment --- src/module/gsc/script_loading.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/module/gsc/script_loading.cpp b/src/module/gsc/script_loading.cpp index ed7a3b4..238f37f 100644 --- a/src/module/gsc/script_loading.cpp +++ b/src/module/gsc/script_loading.cpp @@ -170,10 +170,14 @@ namespace gsc const auto* script_file = files[i]; console::info("Loading script %s...\n", script_file); - sprintf_s(path, "%s/%s", "scripts", script_file); + const auto len = sprintf_s(path, "%s/%s", "scripts", script_file); + if (len == -1) + { + continue; + } // Scr_LoadScriptInternal will add the '.gsc' suffix so we remove it - path[std::strlen(path) - 4] = '\0'; + path[len - 4] = '\0'; if (!game::native::Scr_LoadScript(path)) {