From cdc3eb86636ea5f906925f91ece438acd236d046 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 30 Dec 2023 20:34:22 -0500 Subject: [PATCH] Fix "does not exist" showing up when loading stamps by id or filepath in console SetLastError will always cause the error to show up in the console. Use tempfile->GetError() instead, which will return the same error message anyway unless the stamp doesn't exist. --- src/client/Client.cpp | 1 - src/lua/LuaScriptInterface.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/Client.cpp b/src/client/Client.cpp index d44e5230b..9679ca68c 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -445,7 +445,6 @@ std::unique_ptr Client::LoadSaveFile(ByteString filename) { file->SetLoadingError(err.FromUtf8()); } - commandInterface->SetLastError(err.FromUtf8()); } return file; } diff --git a/src/lua/LuaScriptInterface.cpp b/src/lua/LuaScriptInterface.cpp index 7d81f9eeb..c56308242 100644 --- a/src/lua/LuaScriptInterface.cpp +++ b/src/lua/LuaScriptInterface.cpp @@ -2232,7 +2232,7 @@ int LuaScriptInterface::simulation_loadStamp(lua_State * l) { pushed = 2; lua_pushnil(l); - tpt_lua_pushString(l, luacon_ci->GetLastError()); + tpt_lua_pushString(l, tempfile ? tempfile->GetError() : "does not exist"); } return pushed; }