From 8a33464fa997040b1285282118f06fba79028e6a Mon Sep 17 00:00:00 2001 From: Niels Date: Fri, 5 Nov 2010 13:07:12 +0100 Subject: [PATCH] do not crash if plugins could not be loaded --- monavlayer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/monavlayer.cpp b/monavlayer.cpp index dd41867..6f29083 100644 --- a/monavlayer.cpp +++ b/monavlayer.cpp @@ -63,6 +63,8 @@ MonavLayer::MonavLayer(MapWidget *map) : } else { m_loaded = false; } + } else { + m_loaded = false; } QPluginLoader gLoader(gpsLookupLib); plugin = gLoader.instance(); @@ -74,6 +76,8 @@ MonavLayer::MonavLayer(MapWidget *map) : } else { m_loaded = false; } + } else { + m_loaded = false; } } @@ -146,7 +150,7 @@ void MonavLayer::keyPressed(QKeyEvent *event) QPointF p = map()->geoPos(); UnsignedCoordinate coord(GPSCoordinate(p.y(), p.x())); IGPSLookup::Result pos; - if (m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) { + if (m_loaded && m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) { m_routeStart = p; } } @@ -158,7 +162,7 @@ void MonavLayer::keyPressed(QKeyEvent *event) QPointF p = map()->geoPos(); UnsignedCoordinate coord(GPSCoordinate(p.y(), p.x())); IGPSLookup::Result pos; - if (m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) { + if (m_loaded && m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) { m_routeEnd = p; } }