From: tbaudier Date: Fri, 2 Dec 2016 09:24:13 +0000 (+0100) Subject: Debug Profile tool cancel X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cbe5a471e16307e956e4cf5653a61cd5d83c4ee3;p=clitk.git Debug Profile tool cancel A segmentation fault occured after a click on Cancel during image selection --- diff --git a/vv/vvToolProfile.cxx b/vv/vvToolProfile.cxx index 4360fee..6ebe144 100644 --- a/vv/vvToolProfile.cxx +++ b/vv/vvToolProfile.cxx @@ -361,18 +361,19 @@ void vvToolProfile::cancelPoints() //------------------------------------------------------------------------------ void vvToolProfile::RemoveVTKObjects() { - for(int i=0;iGetNumberOfSlicers(); i++) { - mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->RemoveActor(mLineActors[i]); - } + if (mCurrentSlicerManager) + { + for(int i=0;iGetNumberOfSlicers(); i++) { + mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->RemoveActor(mLineActors[i]); + } - if (mPoint1Selected) - mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P1", mPoint1[3]); - if (mPoint2Selected) - mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P2", mPoint2[3]); + if (mPoint1Selected) + mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P1", mPoint1[3]); + if (mPoint2Selected) + mCurrentSlicerManager->GetLandmarks()->RemoveLandmarkWithLabel("P2", mPoint2[3]); - - if (mCurrentSlicerManager) mCurrentSlicerManager->Render(); + } } //------------------------------------------------------------------------------