1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Fix crash when using locationbar with show switch tab option disabled

Closes #1749
This commit is contained in:
David Rosca 2015-11-24 18:42:04 +01:00
parent 06e504e630
commit 072f459ba5

View File

@ -131,10 +131,12 @@ void LocationCompleter::indexActivated(const QModelIndex &index)
Q_ASSERT(index.isValid()); Q_ASSERT(index.isValid());
const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl(); const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt();
bool ok;
const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt(&ok);
// Switch to tab with simple index activation // Switch to tab with simple index activation
if (tabPos > -1) { if (ok && tabPos > -1) {
BrowserWindow* window = static_cast<BrowserWindow*>(index.data(LocationCompleterModel::TabPositionWindowRole).value<void*>()); BrowserWindow* window = static_cast<BrowserWindow*>(index.data(LocationCompleterModel::TabPositionWindowRole).value<void*>());
Q_ASSERT(window); Q_ASSERT(window);
switchToTab(window, tabPos); switchToTab(window, tabPos);