From b0295ac4d39db96b9837c44f5b0ffb0d577d418f Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Fri, 26 Oct 2018 21:09:10 +0200 Subject: Improve error reporting in plugin loading Change-Id: Ic49ab959a028adc9edd60018351386d51b2a9bca Reviewed-by: Alex Blasche --- src/location/maps/qgeoserviceprovider.cpp | 11 ++++++++++- src/location/maps/qgeoserviceprovider.h | 3 ++- 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 * mgr = d_ptr->manager( &(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 ¶meters) // 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(instance); if (!factoryV3) { factoryV2 = qobject_cast(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 { -- cgit v1.2.1