diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-06-13 13:53:02 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-06-13 13:53:02 +0200 |
commit | 7aa530c4cad478f5555f240d63e2e31c9766fbd5 (patch) | |
tree | aa059232e8894c304716ca5374bf11033599dccb | |
parent | 52493767fcb793e27a7caea30c4eef1c2d0b5ecc (diff) | |
parent | beae9b0bc161cb251d9be73077bd50d03ab67838 (diff) | |
download | redot-engine-7aa530c4cad478f5555f240d63e2e31c9766fbd5.tar.gz |
Merge pull request #78171 from MewPurPur/fix-curve-editor-crash
Fix Curve Editor crash with null curve
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 8 | ||||
-rw-r--r-- | editor/plugins/gradient_texture_2d_editor_plugin.cpp | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index eeb8e998b9..a1a692bdd1 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -978,9 +978,11 @@ void CurveEditor::_notification(int p_what) { } break; case NOTIFICATION_READY: { Ref<Curve> curve = curve_editor_rect->get_curve(); - // Set snapping settings based on the curve's meta. - snap_button->set_pressed(curve->get_meta("_snap_enabled", false)); - snap_count_edit->set_value(curve->get_meta("_snap_count", DEFAULT_SNAP)); + if (curve.is_valid()) { + // Set snapping settings based on the curve's meta. + snap_button->set_pressed(curve->get_meta("_snap_enabled", false)); + snap_count_edit->set_value(curve->get_meta("_snap_count", DEFAULT_SNAP)); + } } break; } } diff --git a/editor/plugins/gradient_texture_2d_editor_plugin.cpp b/editor/plugins/gradient_texture_2d_editor_plugin.cpp index dd91b1356d..08de48af18 100644 --- a/editor/plugins/gradient_texture_2d_editor_plugin.cpp +++ b/editor/plugins/gradient_texture_2d_editor_plugin.cpp @@ -265,9 +265,11 @@ void GradientTexture2DEditor::_notification(int p_what) { snap_button->set_icon(get_theme_icon(SNAME("SnapGrid"), SNAME("EditorIcons"))); } break; case NOTIFICATION_READY: { - // Set snapping settings based on the texture's meta. - snap_button->set_pressed(texture->get_meta("_snap_enabled", false)); - snap_count_edit->set_value(texture->get_meta("_snap_count", DEFAULT_SNAP)); + if (texture.is_valid()) { + // Set snapping settings based on the texture's meta. + snap_button->set_pressed(texture->get_meta("_snap_enabled", false)); + snap_count_edit->set_value(texture->get_meta("_snap_count", DEFAULT_SNAP)); + } } break; } } |