diff options
Diffstat (limited to 'src/webengine/webview.cpp')
-rw-r--r-- | src/webengine/webview.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp index 38e564a..bc52102 100644 --- a/src/webengine/webview.cpp +++ b/src/webengine/webview.cpp @@ -37,9 +37,7 @@ WebView::WebView(WebProfile *profile, cb_createWindow_t cb, QWidget *parent) : WebView(parent) { cb_createWindow = cb; - Q_CHECK_PTR(profile); - m_profile = profile; - setPage(new WebPage(profile, this)); + setProfile(profile); } WebView::WebView(const Session::WebView &webview_data, cb_createWindow_t cb, QWidget *parent) @@ -47,11 +45,7 @@ WebView::WebView(const Session::WebView &webview_data, cb_createWindow_t cb, QWi { cb_createWindow = cb; WebProfileManager profileManager; - - auto *profile = profileManager.profile(webview_data.profile); - if(profile != nullptr) { - setProfile(profile); - } + setProfile(profileManager.profile(webview_data.profile)); if(!webview_data.url.isEmpty()) load(QUrl::fromUserInput(webview_data.url)); @@ -64,9 +58,9 @@ WebView::WebView(const Session::WebView &webview_data, cb_createWindow_t cb, QWi void WebView::setProfile(WebProfile *profile) { - m_profile = profile; + m_profile = (profile == nullptr) ? WebProfile::defaultProfile() : profile; const auto url = this->url(); - setPage(new WebPage(profile, this)); + setPage(new WebPage(m_profile, this)); this->load(url); } |