Skip to content

Commit

Permalink
Explicitly check for parameter in Duel.LoadScript to be a string
Browse files Browse the repository at this point in the history
Don't allow implicit conversions
  • Loading branch information
edo9300 committed Sep 21, 2024
1 parent a2520fd commit d7d4406
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libduel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4037,6 +4037,7 @@ LUA_STATIC_FUNCTION(GetCardFromCardID) {
LUA_STATIC_FUNCTION(LoadScript) {
using SLS = duel::SCRIPT_LOAD_STATUS;
check_param_count(L, 1);
check_param<LuaParam::STRING>(L, 1);
const auto* string = lua_tolstring(L, 1, nullptr);
if(!string || *string == '\0')
lua_error(L, "Parameter 1 should be a non empty \"String\".");
Expand Down

0 comments on commit d7d4406

Please sign in to comment.