diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp
index 7f7018fedd7ed82298c41a0fabf39376065dc30b..dc11e1426239014bdf79dc5d0d69a06f2a73e501 100644
--- a/GeoLib/GEOObjects.cpp
+++ b/GeoLib/GEOObjects.cpp
@@ -418,7 +418,8 @@ int GEOObjects::mergeGeometries (std::vector<std::string> const & geo_names,
 
 	std::vector<std::size_t> pnt_offsets(n_geo_names, 0);
 
-	mergePoints(geo_names, merged_geo_name, pnt_offsets);
+	if (mergePoints(geo_names, merged_geo_name, pnt_offsets))
+		return -1;
 
 	mergePolylines(geo_names, merged_geo_name, pnt_offsets);