From 826282a47f3c035088e944dcbd7a0748fc7c9df2 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 15 Nov 2010 03:16:23 +0000 Subject: [PATCH] check for the existance of a shape index before trying to open it --- plugins/input/shape/shape_io.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/input/shape/shape_io.cpp b/plugins/input/shape/shape_io.cpp index d13b3ed1f..ede0d2466 100644 --- a/plugins/input/shape/shape_io.cpp +++ b/plugins/input/shape/shape_io.cpp @@ -24,7 +24,7 @@ #include "shape_io.hpp" #include "shape.hpp" - +#include using mapnik::datasource_exception; using mapnik::geometry_type; @@ -47,6 +47,11 @@ shape_io::shape_io(const std::string& shape_name) } try { + if (!boost::filesystem::exists(shape_name + INDEX)) + { + throw datasource_exception("Shape Plugin Warning: Could not open index: '" + shape_name + INDEX + "' does not exist"); + } + index_= boost::shared_ptr(new shape_file(shape_name + INDEX)); } catch (...)