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);