diff --git a/Gui/VtkVis/VtkMeshConverter.cpp b/Gui/VtkVis/VtkMeshConverter.cpp
index 1a1a472b13f1badedbf357b2b2df8eeab6c77b10..0f4c0fd0701c7bd7ff7ff32196f324e2b26db734 100644
--- a/Gui/VtkVis/VtkMeshConverter.cpp
+++ b/Gui/VtkVis/VtkMeshConverter.cpp
@@ -89,7 +89,7 @@ MeshLib::Mesh* VtkMeshConverter::convertImgToMesh(vtkImageData* img,
 
 			// is current pixel visible
 			if (nTuple == 2 || nTuple == 4)
-				visNodes[index] = (colour[nTuple-1] > 0);
+				visNodes[index] = (colour[nTuple-1] != 0);
 			else
 				visNodes[index] = true;
 
@@ -239,6 +239,9 @@ MeshLib::Mesh* VtkMeshConverter::constructMesh(const double* pixVal,
 			}
 		}
 
+	if (elements.empty())
+		return nullptr;
+
 	return new MeshLib::Mesh("RasterDataMesh", nodes, elements); // the name is only a temp-name, the name given in the dialog is set later
 }
 
diff --git a/Gui/VtkVis/VtkVisPipelineView.cpp b/Gui/VtkVis/VtkVisPipelineView.cpp
index 74626e9c4dd5b205a348d5027051c769fadc4822..8b9b1554df791edefdd4541a16deae48a3acb4d7 100644
--- a/Gui/VtkVis/VtkVisPipelineView.cpp
+++ b/Gui/VtkVis/VtkVisPipelineView.cpp
@@ -15,6 +15,8 @@
 // ** INCLUDES **
 #include "VtkVisPipelineView.h"
 
+#include "OGSError.h"
+
 #include "CheckboxDelegate.h"
 #include "VtkVisPipeline.h"
 #include "VtkVisPipelineItem.h"
@@ -211,8 +213,13 @@ void VtkVisPipelineView::constructMeshFromImage(QString msh_name, MeshElemType e
 	imageSource->GetOutput()->GetSpacing(spacing);
 
 	MeshLib::Mesh* mesh = VtkMeshConverter::convertImgToMesh(imageSource->GetOutput(), origin, spacing[0], element_type, intensity_type);
-	mesh->setName(msh_name.toStdString());
-	emit meshAdded(mesh);
+	if (mesh)
+	{
+		mesh->setName(msh_name.toStdString());
+		emit meshAdded(mesh);
+	}
+	else
+		OGSError::box("Error creating mesh.");
 }
 
 void VtkVisPipelineView::convertVTKToOGSMesh()