diff --git a/include/mapnik/json/error_handler.hpp b/include/mapnik/json/error_handler.hpp index f1a4f8b1e..7432c10f0 100644 --- a/include/mapnik/json/error_handler.hpp +++ b/include/mapnik/json/error_handler.hpp @@ -38,7 +38,10 @@ struct error_handler Iterator err_pos, boost::spirit::info const& what) const { std::stringstream s; - s << what << " expected but got: " << std::string(err_pos, std::min(err_pos + 16,last)); + auto start = err_pos; + std::advance(err_pos,16); + auto end = err_pos; + s << what << " expected but got: " << std::string(start, end); throw std::runtime_error(s.str()); } };