From 3f2a10bb4b1a98dacf28eae203bbc270252db8bc Mon Sep 17 00:00:00 2001 From: OgelGames Date: Sun, 30 Jul 2023 23:53:47 +1000 Subject: [PATCH] Fix decode_base64 returning nothing instead of nil (#13697) --- src/script/lua_api/l_util.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index 2846f7b3a..07cc77297 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -393,8 +393,10 @@ int ModApiUtil::l_decode_base64(lua_State *L) const char *d = luaL_checklstring(L, 1, &size); const std::string data = std::string(d, size); - if (!base64_is_valid(data)) - return 0; + if (!base64_is_valid(data)) { + lua_pushnil(L); + return 1; + } std::string out = base64_decode(data);