FIX: crash when open 3mf file

the volume type is unreasonable, causing the array to go out of bounds

Change-Id: I316b05f277f894b1fd32cda3eca29340d988e01e
This commit is contained in:
zhimin.zeng 2023-03-16 10:59:10 +08:00 committed by Lane.Wei
parent 60f524167d
commit 6f141ea740

View file

@ -495,8 +495,9 @@ wxDataViewItem ObjectDataViewModel::AddOutsidePlate(bool refresh)
void ObjectDataViewModel::UpdateBitmapForNode(ObjectDataViewModelNode *node)
{
bool is_volume_node = node->GetType() & itVolume;
int vol_type = static_cast<int>(node->GetVolumeType());
bool is_volume_node = vol_type >= 0;
is_volume_node &= (vol_type >= int(ModelVolumeType::MODEL_PART) && vol_type <= int(ModelVolumeType::SUPPORT_ENFORCER));
if (!node->has_warning_icon() && !node->has_lock()) {
node->SetBitmap(is_volume_node ? m_volume_bmps.at(vol_type) : m_empty_bmp);