From 853006afb09cd42a902b6cf7d64c3ff65bb77a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Apr 2016 09:20:11 +0200 Subject: [PATCH] only create a polyline item if the intersection is not empty --- .../Operations_on_polyhedra/Intersection_plugin.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp index 00dafd7a565..195f18a051f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Intersection_plugin.cpp @@ -209,10 +209,14 @@ void Polyhedron_demo_intersection_plugin::intersection() #endif std::cout << "ok (" << time.elapsed() << " ms)" << std::endl; - new_item->setColor(Qt::green); - new_item->setRenderingMode(Wireframe); - scene->addItem(new_item); - new_item->invalidateOpenGLBuffers(); + if (new_item->polylines.empty()) + delete new_item; + else{ + new_item->setColor(Qt::green); + new_item->setRenderingMode(Wireframe); + scene->addItem(new_item); + new_item->invalidateOpenGLBuffers(); + } QApplication::restoreOverrideCursor(); }