mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -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,6 +326,7 @@ void GLGizmoText::on_set_state()
|
|||
if (m_state == EState::On) {
|
||||
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);
|
||||
if (model_volume) {
|
||||
TextInfo text_info = model_volume->get_text_info();
|
||||
if (!text_info.m_text.empty()) {
|
||||
load_from_text_info(text_info);
|
||||
|
@ -333,6 +334,7 @@ void GLGizmoText::on_set_state()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_state == EState::Off) {
|
||||
reset_text_info();
|
||||
delete_temp_preview_text_volume();
|
||||
|
@ -901,8 +903,8 @@ ModelVolume *GLGizmoText::get_selected_single_volume(int &out_object_idx, int &o
|
|||
out_object_idx = gl_volume->object_idx();
|
||||
ModelObject *model_object = selection.get_model()->objects[out_object_idx];
|
||||
out_volume_idx = gl_volume->volume_idx();
|
||||
ModelVolume *model_volume = model_object->volumes[out_volume_idx];
|
||||
return model_volume;
|
||||
if (out_volume_idx < model_object->volumes.size())
|
||||
return model_object->volumes[out_volume_idx];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue