mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 15:37:30 -06:00
FIX: fix possible crash for text
Change-Id: I57670a55f3e55fd0ded522b501a28899070e802e
This commit is contained in:
parent
6a391de290
commit
a1cd25cd21
1 changed files with 8 additions and 6 deletions
|
@ -326,10 +326,12 @@ void GLGizmoText::on_set_state()
|
||||||
if (m_state == EState::On) {
|
if (m_state == EState::On) {
|
||||||
if (m_parent.get_selection().is_single_volume() || m_parent.get_selection().is_single_modifier()) {
|
if (m_parent.get_selection().is_single_volume() || m_parent.get_selection().is_single_modifier()) {
|
||||||
ModelVolume *model_volume = get_selected_single_volume(m_object_idx, m_volume_idx);
|
ModelVolume *model_volume = get_selected_single_volume(m_object_idx, m_volume_idx);
|
||||||
TextInfo text_info = model_volume->get_text_info();
|
if (model_volume) {
|
||||||
if (!text_info.m_text.empty()) {
|
TextInfo text_info = model_volume->get_text_info();
|
||||||
load_from_text_info(text_info);
|
if (!text_info.m_text.empty()) {
|
||||||
m_is_modify = true;
|
load_from_text_info(text_info);
|
||||||
|
m_is_modify = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -901,8 +903,8 @@ ModelVolume *GLGizmoText::get_selected_single_volume(int &out_object_idx, int &o
|
||||||
out_object_idx = gl_volume->object_idx();
|
out_object_idx = gl_volume->object_idx();
|
||||||
ModelObject *model_object = selection.get_model()->objects[out_object_idx];
|
ModelObject *model_object = selection.get_model()->objects[out_object_idx];
|
||||||
out_volume_idx = gl_volume->volume_idx();
|
out_volume_idx = gl_volume->volume_idx();
|
||||||
ModelVolume *model_volume = model_object->volumes[out_volume_idx];
|
if (out_volume_idx < model_object->volumes.size())
|
||||||
return model_volume;
|
return model_object->volumes[out_volume_idx];
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue