Prevent crash in case of invalid geometries