summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2019-02-26 13:29:31 +0100
committerChristian Strømme <christian.stromme@qt.io>2019-02-26 15:07:03 +0000
commitfc039435b57bb5860ee3c59542d29b106071ffb5 (patch)
treeabf8087f95e6d0d8f6cecaec58cb948539b33868
parent17334eb56b42114927169ee8eec6512754674fb2 (diff)
Make sure that we have a valid plugin before using it
The code assumed that loading the plugin would succeed if we could read its meta-data, this is of course not always the case, as a plugin might not have its dependencies met and fail to load, e.g., this is the case if trying to use the QtWebEngine plugin when QtWebEngine isn't installed. Fixes: QTBUG-71380 Change-Id: Ib88281b2b291213891cfbb77b0728c1bdd6dd1fd Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--src/webview/qtwebviewfunctions.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/webview/qtwebviewfunctions.cpp b/src/webview/qtwebviewfunctions.cpp
index 975bb17..01efbf6 100644
--- a/src/webview/qtwebviewfunctions.cpp
+++ b/src/webview/qtwebviewfunctions.cpp
@@ -61,9 +61,12 @@ QT_BEGIN_NAMESPACE
void QtWebView::initialize()
{
if (QWebViewFactory::requiresExtraInitializationSteps()) {
+ // There might be plugins available, but their dependencies might not be met,
+ // so make sure we have a valid plugin before using it.
+ // Note: A warning will be printed later if we're unable to load the plugin.
QWebViewPlugin *plugin = QWebViewFactory::getPlugin();
- Q_ASSERT(plugin);
- plugin->prepare();
+ if (plugin)
+ plugin->prepare();
}
}