From 3f1bc1520edcdcec378c7b722bbb8b01b67db455 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Tue, 18 Oct 2016 13:46:04 +0200 Subject: [PATCH] Fix crashing on vertex click after deselect This was a nasty long-timer bug. A lot of unfortunate crashes before autosave was there. It usually happened when one was trying to click on the selected surface vertex, failed and then tried again. The selection widget joints were still hitTested, but as there was no selection anymore, the app crashed while trying to access a vertex of a non-existing surface. --- src/Gui/Widgets/ProjectionEditorWidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Gui/Widgets/ProjectionEditorWidget.cpp b/src/Gui/Widgets/ProjectionEditorWidget.cpp index bb770db..0728370 100644 --- a/src/Gui/Widgets/ProjectionEditorWidget.cpp +++ b/src/Gui/Widgets/ProjectionEditorWidget.cpp @@ -195,6 +195,9 @@ void ProjectionEditorWidget::setSnapDistance(float newSnapDistance){ } CircleJoint * ProjectionEditorWidget::hitTestJoints(ofVec2f pos){ + if(surfaceManager->getSelectedSurface() == 0){ + return 0; + } for(int i = 0; i < joints.size(); i++){ if(joints[i]->hitTest(pos)){ return joints[i];