@@ -108,44 +108,60 @@ class BOOST_URI_DECL uri {
108108 return uri_parts_.fragment ? uri_parts_.fragment .get () : const_range_type ();
109109 }
110110
111+ // hackfix by Simon Haegler, Esri R&D Zurich
112+ // this workaround is needed to avoid running into the "incompatible string iterator" assertion
113+ // triggered by the default-constructed string iterators employed by cpp-netlib (see uri.ipp qi::rule declarations)
114+ #if defined(_MSC_VER) && defined(_DEBUG)
115+ # define CATCH_EMPTY_ITERATOR_RANGE if (range.begin()._Getcont() == 0 || range.end()._Getcont() == 0 ) { return string_type (); }
116+ #else
117+ # define CATCH_EMPTY_ITERATOR_RANGE
118+ #endif
119+
111120 string_type scheme () const {
112121 const_range_type range = scheme_range ();
113- return range ? string_type (boost::begin (range), boost::end (range))
122+ CATCH_EMPTY_ITERATOR_RANGE
123+ return range ? string_type (boost::begin (range), boost::end (range))
114124 : string_type ();
115125 }
116126
117127 string_type user_info () const {
118128 const_range_type range = user_info_range ();
129+ CATCH_EMPTY_ITERATOR_RANGE
119130 return range ? string_type (boost::begin (range), boost::end (range))
120131 : string_type ();
121132 }
122133
123134 string_type host () const {
124135 const_range_type range = host_range ();
136+ CATCH_EMPTY_ITERATOR_RANGE
125137 return range ? string_type (boost::begin (range), boost::end (range))
126138 : string_type ();
127139 }
128140
129141 string_type port () const {
130142 const_range_type range = port_range ();
143+ CATCH_EMPTY_ITERATOR_RANGE
131144 return range ? string_type (boost::begin (range), boost::end (range))
132145 : string_type ();
133146 }
134147
135148 string_type path () const {
136149 const_range_type range = path_range ();
150+ CATCH_EMPTY_ITERATOR_RANGE
137151 return range ? string_type (boost::begin (range), boost::end (range))
138152 : string_type ();
139153 }
140154
141155 string_type query () const {
142156 const_range_type range = query_range ();
157+ CATCH_EMPTY_ITERATOR_RANGE
143158 return range ? string_type (boost::begin (range), boost::end (range))
144159 : string_type ();
145160 }
146161
147162 string_type fragment () const {
148163 const_range_type range = fragment_range ();
164+ CATCH_EMPTY_ITERATOR_RANGE
149165 return range ? string_type (boost::begin (range), boost::end (range))
150166 : string_type ();
151167 }
0 commit comments