From c61d78ed048e0404389cb43867e2b238d7109b36 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 31 Aug 2011 11:22:25 +0200 Subject: Fix SSL widget crash This was the crash (probably) occurred during ds2011 presentation. Check if a list is empty before pulling something (with QList::first() method). --- src/urlbar/sslwidget.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/urlbar/sslwidget.cpp') diff --git a/src/urlbar/sslwidget.cpp b/src/urlbar/sslwidget.cpp index 64275e81..1366d5cc 100644 --- a/src/urlbar/sslwidget.cpp +++ b/src/urlbar/sslwidget.cpp @@ -58,14 +58,13 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) QStringList firstCertErrorList; if (!certErrorList.isEmpty()) firstCertErrorList = certErrorList.first(); - QGridLayout *layout = new QGridLayout(this); QLabel *label; QLabel *imageLabel; int rows = 0; - // ------------------------------------------------------------------------------------------------------------------ + // ------------------------------------------------------------------------------------------------------ imageLabel = new QLabel(this); layout->addWidget(imageLabel, rows , 0, Qt::AlignCenter); @@ -82,9 +81,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) if (cert.isNull()) { label->setText(i18n("Warning: this site is NOT carrying a certificate!")); - imageLabel->setPixmap(KIcon("security-low").pixmap(32)); - layout->addWidget(label, rows++, 1); } else @@ -119,7 +116,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) layout->addWidget(label, rows++, 1); } - // ------------------------------------------------------------------------------------------------------------------ + // ------------------------------------------------------------------------------------------------------------- label = new QLabel(this); label->setWordWrap(true); label->setText(i18n("Encryption")); @@ -206,7 +203,10 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) label = new QLabel(this); label->setWordWrap(true); - HistoryItem firstVisit = rApp->historyManager()->find(url.toString()).first(); + QList hList = rApp->historyManager()->find(url.toString()); + HistoryItem firstVisit = hList.isEmpty() ? + HistoryItem() : + hList.first() ; if (firstVisit.visitCount == 1) { -- cgit v1.2.1