From d4277789a6644e7c9cf3dc5ab6a1a5e33f917663 Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Sun, 27 Oct 2024 12:48:11 +0100 Subject: [PATCH] SporeModLoader: improve C++ ends_with() check for C++17 --- SporeModLoader/SporeModLoaderHelpers.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SporeModLoader/SporeModLoaderHelpers.cpp b/SporeModLoader/SporeModLoaderHelpers.cpp index 3a0d6fc..3998a31 100644 --- a/SporeModLoader/SporeModLoaderHelpers.cpp +++ b/SporeModLoader/SporeModLoaderHelpers.cpp @@ -139,7 +139,8 @@ std::vector Path::GetModLibsPaths(void) #ifdef __cpp_lib_starts_ends_with if (filename.ends_with(postfix)) #else // C++17 - if (filename.find(postfix) != std::wstring::npos) + if (filename.size() >= postfix.size() && + filename.find(postfix, filename.size() - postfix.size()) != std::wstring::npos) #endif { skipLib = true;