1
0
mirror of git://projects.qi-hardware.com/nanomap.git synced 2024-11-28 03:10:17 +02:00

do not crash if plugins could not be loaded

This commit is contained in:
Niels 2010-11-05 13:07:12 +01:00
parent 6c6fabbbda
commit 8a33464fa9

View File

@ -63,6 +63,8 @@ MonavLayer::MonavLayer(MapWidget *map) :
} else { } else {
m_loaded = false; m_loaded = false;
} }
} else {
m_loaded = false;
} }
QPluginLoader gLoader(gpsLookupLib); QPluginLoader gLoader(gpsLookupLib);
plugin = gLoader.instance(); plugin = gLoader.instance();
@ -74,6 +76,8 @@ MonavLayer::MonavLayer(MapWidget *map) :
} else { } else {
m_loaded = false; m_loaded = false;
} }
} else {
m_loaded = false;
} }
} }
@ -146,7 +150,7 @@ void MonavLayer::keyPressed(QKeyEvent *event)
QPointF p = map()->geoPos(); QPointF p = map()->geoPos();
UnsignedCoordinate coord(GPSCoordinate(p.y(), p.x())); UnsignedCoordinate coord(GPSCoordinate(p.y(), p.x()));
IGPSLookup::Result pos; IGPSLookup::Result pos;
if (m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) { if (m_loaded && m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) {
m_routeStart = p; m_routeStart = p;
} }
} }
@ -158,7 +162,7 @@ void MonavLayer::keyPressed(QKeyEvent *event)
QPointF p = map()->geoPos(); QPointF p = map()->geoPos();
UnsignedCoordinate coord(GPSCoordinate(p.y(), p.x())); UnsignedCoordinate coord(GPSCoordinate(p.y(), p.x()));
IGPSLookup::Result pos; IGPSLookup::Result pos;
if (m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) { if (m_loaded && m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) {
m_routeEnd = p; m_routeEnd = p;
} }
} }