From 3a23b6360834b0c908fa5a7f88a88f2d18f4111d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 28 May 2014 16:00:24 +0000 Subject: [PATCH] Fixed some cppcheck warnings git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18748 383ad7c9-94d9-4d36-a494-682f7c89f535 --- SmootherPlugin.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/SmootherPlugin.cc b/SmootherPlugin.cc index f3c5762..0fcce5e 100644 --- a/SmootherPlugin.cc +++ b/SmootherPlugin.cc @@ -148,6 +148,11 @@ slot_smooth() // Get triangle mesh TriMesh* mesh = PluginFunctions::triMesh(*o_it); + if ( mesh == NULL ) { + emit log(LOGERR, "Unable to get mesh from object( Only Triangle Meshes supported)"); + return; + } + if (data == 0){ data = new SmootherObject(); o_it->setObjectData(SMOOTHER, data); @@ -219,9 +224,7 @@ slot_smooth() jobDescription += ") " + QString::number(tool_->sB_iter->value()) + " iterations"; - if (mesh != 0) -// mesh->garbage_collection(); - mesh->update_normals(); + mesh->update_normals(); emit updatedObject( o_it->id(), UPDATE_GEOMETRY ); emit createBackup(o_it->id(), "Smoothing", UPDATE_GEOMETRY ); @@ -266,6 +269,11 @@ void SmootherPlugin::smooth(int _objectId , int _iterations , QString _direction // Get triangle mesh TriMesh* mesh = PluginFunctions::triMesh(object); + if ( mesh == NULL ) { + emit log(LOGERR, "Unable to get mesh from object( Only Triangle Meshes supported)"); + return; + } + if (data == 0){ data = new SmootherObject(); object->setObjectData(SMOOTHER, data); @@ -325,10 +333,7 @@ void SmootherPlugin::smooth(int _objectId , int _iterations , QString _direction jobDescription += ") " + QString::number(_iterations) + " iterations"; - if (mesh != 0) { - mesh->garbage_collection(); - mesh->update_normals(); - } + mesh->update_normals(); emit updatedObject( object->id(), UPDATE_GEOMETRY ); -- GitLab