summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-10-26 21:09:10 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-11-05 10:32:24 +0000
commitb0295ac4d39db96b9837c44f5b0ffb0d577d418f (patch)
tree12cf81ddd70b635074c1d56c129eeb46d651bf71
parente11c830eeab55c3085fb8248e9d1190a8259251f (diff)
downloadqtlocation-b0295ac4d39db96b9837c44f5b0ffb0d577d418f.tar.gz
Improve error reporting in plugin loading
Change-Id: Ic49ab959a028adc9edd60018351386d51b2a9bca Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/maps/qgeoserviceprovider.cpp11
-rw-r--r--src/location/maps/qgeoserviceprovider.h3
2 files changed, 12 insertions, 2 deletions
diff --git a/src/location/maps/qgeoserviceprovider.cpp b/src/location/maps/qgeoserviceprovider.cpp
index 11b1c28d..c6b9d742 100644
--- a/src/location/maps/qgeoserviceprovider.cpp
+++ b/src/location/maps/qgeoserviceprovider.cpp
@@ -534,9 +534,13 @@ QPlaceManager *QGeoServiceProvider::placeManager() const
*/
QNavigationManager *QGeoServiceProvider::navigationManager() const
{
- return d_ptr->manager<QNavigationManager, QNavigationManagerEngine>(
+ QNavigationManager * mgr = d_ptr->manager<QNavigationManager, QNavigationManagerEngine>(
&(d_ptr->navigationError), &(d_ptr->navigationErrorString),
&(d_ptr->navigationManager));
+ if (!mgr) {
+ qDebug() << d_ptr->navigationError << d_ptr->navigationErrorString;
+ }
+ return mgr;
}
/*!
@@ -747,6 +751,11 @@ void QGeoServiceProviderPrivate::loadPlugin(const QVariantMap &parameters)
// load the actual plugin
QObject *instance = loader()->instance(idx);
+ if (!instance) {
+ error = QGeoServiceProvider::LoaderError;
+ errorString = QLatin1String("loader()->instance(idx) failed to return an instance");
+ return;
+ }
factoryV3 = qobject_cast<QGeoServiceProviderFactoryV3 *>(instance);
if (!factoryV3) {
factoryV2 = qobject_cast<QGeoServiceProviderFactoryV2 *>(instance);
diff --git a/src/location/maps/qgeoserviceprovider.h b/src/location/maps/qgeoserviceprovider.h
index 8e594977..b2e0be05 100644
--- a/src/location/maps/qgeoserviceprovider.h
+++ b/src/location/maps/qgeoserviceprovider.h
@@ -69,7 +69,8 @@ public:
NotSupportedError,
UnknownParameterError,
MissingRequiredParameterError,
- ConnectionError
+ ConnectionError,
+ LoaderError
};
enum RoutingFeature {