1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Added missing data validity checks

This commit is contained in:
Martin Tůma 2017-05-05 09:00:57 +02:00
parent c339116cd1
commit ff015c8714

View File

@ -121,7 +121,10 @@ int OfflineMap::parse(QIODevice &device, QList<ReferencePoint> &points,
p.xy = QPoint(x, y); p.xy = QPoint(x, y);
if (ll) { if (ll) {
p.ll = Coordinates(lond + lonm/60.0, latd + latm/60.0); p.ll = Coordinates(lond + lonm/60.0, latd + latm/60.0);
points.append(p); if (p.ll.isValid())
points.append(p);
else
return ln;
} else if (pp) { } else if (pp) {
p.pp = QPointF(ppx, ppy); p.pp = QPointF(ppx, ppy);
setup.zone = zone; setup.zone = zone;
@ -205,6 +208,14 @@ bool OfflineMap::createProjection(const QString &datum,
return false; return false;
} }
if (setup.latitudeOrigin < -90.0 || setup.latitudeOrigin > 90.0
|| setup.longitudeOrigin < -180.0 || setup.longitudeOrigin > 180.0
|| setup.standardParallel1 < -90 || setup.standardParallel1 > 90
|| setup.standardParallel2 < -90 || setup.standardParallel2 > 90) {
_errorString = "Invalid projection setup";
return false;
}
if (projection == "Mercator") if (projection == "Mercator")
_projection = new Mercator(); _projection = new Mercator();
else if (projection == "Transverse Mercator") else if (projection == "Transverse Mercator")