Switch away from CheckDFObject in unprotected calls

See https://github.com/DFHack/dfhack/pull/1674#issuecomment-716028460
develop
lethosor 2020-10-24 14:27:33 -04:00
parent 488c5509fc
commit 58917b03d1
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
2 changed files with 8 additions and 2 deletions

@ -303,11 +303,14 @@ static bool construct_planned_building()
return false;
}
auto bld = Lua::CheckDFObject<df::building>(L, -1);
auto bld = Lua::GetDFObject<df::building>(L, -1);
lua_pop(L, 1);
if (!bld)
{
out.printerr("buildingplan: construct_building_from_ui_state() failed\n");
return false;
}
planner.addPlannedBuilding(bld);

@ -72,11 +72,14 @@ struct BuildingInfo {
if (!Lua::SafeCall(out, L, 4, 1))
return false;
auto bld = Lua::CheckDFObject<df::building>(L, -1);
auto bld = Lua::GetDFObject<df::building>(L, -1);
lua_pop(L, 1);
if (!bld)
{
out.printerr("fortplan: construct_building_from_params() failed\n");
return false;
}
planner.addPlannedBuilding(bld);