From f2f81d9703aceddb8a25db9e392fee0acf2f289a Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Tue, 30 Oct 2018 14:44:05 +0100 Subject: Fix crash adding point to a Curve2D from the editor Adding point to a Path2D with null Curve2D from the canvas was causing a crash after trying to use a null object. --- scene/2d/path_2d.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index cdb208e6cd..4276918f53 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -63,6 +63,10 @@ bool Path2D::_edit_use_rect() const { bool Path2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { + if (curve.is_null()) { + return false; + } + for (int i = 0; i < curve->get_point_count(); i++) { Vector2 s[2]; s[0] = curve->get_point_position(i); -- cgit v1.2.3