1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Fixed crash on GPX files with empty tracks/routes

This commit is contained in:
Martin Tůma 2016-09-27 10:19:39 +02:00
parent eae55b14bb
commit 6b8c0231ea

View File

@ -115,18 +115,13 @@ void PathView::addWaypoints(const QList<Waypoint> &waypoints)
QList<PathItem *> PathView::loadGPX(const GPX &gpx)
{
QList<PathItem *> paths;
PathItem *pi;
int zoom = _zoom;
for (int i = 0; i < gpx.tracks().count(); i++) {
if ((pi = addTrack(*(gpx.tracks().at(i)))))
paths.append(pi);
}
for (int i = 0; i < gpx.routes().count(); i++) {
if ((pi = addRoute(*(gpx.routes().at(i)))))
paths.append(pi);
}
for (int i = 0; i < gpx.tracks().count(); i++)
paths.append(addTrack(*(gpx.tracks().at(i))));
for (int i = 0; i < gpx.routes().count(); i++)
paths.append(addRoute(*(gpx.routes().at(i))));
addWaypoints(gpx.waypoints());
if (_tracks.empty() && _routes.empty() && _waypoints.empty())