diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2024-03-02 14:29:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-02 15:29:58 +0100 |
commit | e1eb2a6f4b858e903603226098861c3b62d5d1a4 (patch) | |
tree | e3f90b1e6a9825ac64f05ed4751f1beb0c99fab1 | |
parent | 026adbebe59a0a9ea1f39a8da135534a2c2ae393 (diff) | |
download | NorthstarLauncher-1.24.3-rc1.tar.gz NorthstarLauncher-1.24.3-rc1.zip |
Don't allow too many arguments to be sent to the map command (#673)v1.24.3-rc1v1.24.2-rc1v1.24.2
`map` should only take a single arg that specifies the map to load.
-rw-r--r-- | primedev/util/printmaps.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/primedev/util/printmaps.cpp b/primedev/util/printmaps.cpp index 906bed06..28325db9 100644 --- a/primedev/util/printmaps.cpp +++ b/primedev/util/printmaps.cpp @@ -200,7 +200,13 @@ AUTOHOOK(Host_Map_f, engine.dll + 0x15B340, void, __fastcall, (const CCommand& a { RefreshMapList(); - if (args.ArgC() > 1 && + if (args.ArgC() > 2) + { + spdlog::warn("Map load failed: too many arguments provided"); + return; + } + else if ( + args.ArgC() == 2 && std::find_if(vMapList.begin(), vMapList.end(), [&](MapVPKInfo map) -> bool { return map.name == args.Arg(1); }) == vMapList.end()) { spdlog::warn("Map load failed: {} not found or invalid", args.Arg(1)); |