diff --git a/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp index af885246ea4..69095bf9de4 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp @@ -196,14 +196,8 @@ CGAL_Lab_c3t3_binary_io_plugin:: save(QFileInfo fileinfo, QList &items) { Scene_item* item = items.front(); - if(!qobject_cast(item)->is_valid()) - { - QMessageBox::warning(CGAL::Three::Three::mainWindow(), "", "The c3t3_item is not valid. You cannot save it."); - return false; - } const Scene_c3t3_item* c3t3_item = qobject_cast(item); - if ( NULL == c3t3_item ) - { + if(nullptr == c3t3_item) { return false; } @@ -211,9 +205,14 @@ save(QFileInfo fileinfo, QList &items) if(path.endsWith(".cgal")) { + if(!c3t3_item->is_valid()) + { + QMessageBox::warning(CGAL::Three::Three::mainWindow(), "", + "The c3t3_item is not valid. You cannot save it in binary cgal format."); + return false; + } std::ofstream out(fileinfo.filePath().toUtf8(), std::ios_base::out|std::ios_base::binary); - bool ok = out && c3t3_item->save_binary(out); if(!ok) return false;