1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +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 *> PathView::loadGPX(const GPX &gpx)
{ {
QList<PathItem *> paths; QList<PathItem *> paths;
PathItem *pi;
int zoom = _zoom; int zoom = _zoom;
for (int i = 0; i < gpx.tracks().count(); i++) {
if ((pi = addTrack(*(gpx.tracks().at(i))))) for (int i = 0; i < gpx.tracks().count(); i++)
paths.append(pi); paths.append(addTrack(*(gpx.tracks().at(i))));
} for (int i = 0; i < gpx.routes().count(); i++)
for (int i = 0; i < gpx.routes().count(); i++) { paths.append(addRoute(*(gpx.routes().at(i))));
if ((pi = addRoute(*(gpx.routes().at(i)))))
paths.append(pi);
}
addWaypoints(gpx.waypoints()); addWaypoints(gpx.waypoints());
if (_tracks.empty() && _routes.empty() && _waypoints.empty()) if (_tracks.empty() && _routes.empty() && _waypoints.empty())