1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

[coverity] Followup fixes

webview.cpp: Fixed pointer to local outside scope
bookmarksmodel.cpp: Unchecked return value
This commit is contained in:
nowrep 2014-02-03 00:10:14 +01:00
parent 5b55d5b483
commit aa6aea1399
2 changed files with 6 additions and 6 deletions

View File

@ -97,12 +97,10 @@ bool BookmarksModel::isBookmarked(const QUrl &url)
query.prepare("SELECT count(id) FROM bookmarks WHERE url=?");
query.bindValue(0, url.toString());
if (!query.exec()) {
if (!query.exec() || !query.next()) {
return false;
}
query.next();
return query.value(0).toInt() > 0;
}

View File

@ -1289,15 +1289,17 @@ void WebView::keyPressEvent(QKeyEvent* event)
// Example: Key_Right within LTR layout triggers QWebPage::MoveToNextChar but,
// Key_Right within RTL layout should trigger QWebPage::MoveToPreviousChar
if (eventKey == Qt::Key_Left || eventKey == Qt::Key_Right) {
// event->spontaneous() check guards recursive calling of keyPressEvent
// Events created from app have spontaneous() == false
if (event->spontaneous() && (eventKey == Qt::Key_Left || eventKey == Qt::Key_Right)) {
const QWebElement elementHasCursor = activeElement();
if (!elementHasCursor.isNull()) {
const QString direction = elementHasCursor.styleProperty("direction", QWebElement::ComputedStyle);
if (direction == QLatin1String("rtl")) {
eventKey = eventKey == Qt::Key_Left ? Qt::Key_Right : Qt::Key_Left;
// FIXME: !!!!!!!!!!!!
QKeyEvent ev(event->type(), eventKey, event->modifiers(), event->text(), event->isAutoRepeat());
event = &ev;
keyPressEvent(&ev);
return;
}
}
}