From fe2af496370572701c6f41aea9869e29404b8f50 Mon Sep 17 00:00:00 2001 From: Sergey Alexandrov Date: Mon, 26 Mar 2018 15:46:26 +0200 Subject: [PATCH] Warn and skip adding normal cloud if it is empty --- .../include/pcl/visualization/impl/pcl_visualizer.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp index a734a357548..263f15b8a5c 100644 --- a/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp +++ b/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp @@ -843,6 +843,13 @@ pcl::visualization::PCLVisualizer::addPointCloudNormals ( PCL_ERROR ("[addPointCloudNormals] The number of points differs from the number of normals!\n"); return (false); } + + if (normals->empty ()) + { + PCL_WARN ("[addPointCloudNormals] An empty normal cloud is given! Nothing to display.\n"); + return (false); + } + if (contains (id)) { PCL_WARN ("[addPointCloudNormals] The id <%s> already exists! Please choose a different id and retry.\n", id.c_str ());