Skip to content

Commit

Permalink
Fix crash applying thing properties with no UDMF flags
Browse files Browse the repository at this point in the history
The SRB2 configuration seems to be a bit broken for UDMF format, but at least now it won't crash

Fix #1733, Fix #1740
  • Loading branch information
sirjuddington committed Dec 23, 2024
1 parent d9fcc9d commit e689720
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/MapEditor/UI/PropsPanel/ThingPropsPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,28 +816,31 @@ void ThingPropsPanel::applyChanges()
// Apply general properties
for (auto& object : objects_)
{
// Flags
if (udmf_flags_.empty())
if (!cb_flags_.empty())
{
for (int f = 0; f < game::configuration().nThingFlags(); f++)
// Flags
if (udmf_flags_.empty())
{
if (cb_flags_[f]->Get3StateValue() != wxCHK_UNDETERMINED)
game::configuration().setThingFlag(f, (MapThing*)object, cb_flags_[f]->GetValue());
for (int f = 0; f < game::configuration().nThingFlags(); f++)
{
if (cb_flags_[f]->Get3StateValue() != wxCHK_UNDETERMINED)
game::configuration().setThingFlag(f, (MapThing*)object, cb_flags_[f]->GetValue());
}
}
}

// UDMF flags
else
{
for (unsigned f = 0; f < udmf_flags_.size(); f++)
// UDMF flags
else
{
if (cb_flags_[f]->Get3StateValue() != wxCHK_UNDETERMINED)
object->setBoolProperty(udmf_flags_[f].ToStdString(), cb_flags_[f]->GetValue());
for (unsigned f = 0; f < udmf_flags_.size(); f++)
{
if (cb_flags_[f]->Get3StateValue() != wxCHK_UNDETERMINED)
object->setBoolProperty(udmf_flags_[f].ToStdString(), cb_flags_[f]->GetValue());
}
}
}

// UDMF extra flags
if (!udmf_flags_extra_.empty())
if (!udmf_flags_extra_.empty() && !cb_flags_extra_.empty())
{
for (unsigned f = 0; f < udmf_flags_extra_.size(); f++)
{
Expand Down

0 comments on commit e689720

Please sign in to comment.