missing check for empty polylines

This commit is contained in:
Dennis Luxen 2011-06-28 09:28:19 +00:00
parent 5b621d8fe9
commit 4639187180

View File

@ -50,8 +50,10 @@ private:
public:
inline void printEncodedString(vector<_Coordinate>& polyline, string &output) {
output += "\"";
if(polyline.size() > 0) {
output += encodeSignedNumber(polyline[0].lat);
output += encodeSignedNumber(polyline[0].lon);
}
for(unsigned i = 1; i < polyline.size(); i++) {
output += encodeSignedNumber(polyline[i].lat - polyline[i-1].lat);
output += encodeSignedNumber(polyline[i].lon - polyline[i-1].lon);