[kde-doc-english] [trojita] src/Gui: GUI: be a bit more defensive in object casting
Jan Kundrát
jkt at kde.org
Fri Jul 24 07:15:07 UTC 2015
Git commit 2506900e3ccd43a8b6c0fdff79333ded43edc6dc by Jan Kundrát.
Committed on 19/07/2015 at 10:54.
Pushed by gerrit into branch 'master'.
GUI: be a bit more defensive in object casting
Change-Id: I2809dfc42f85653960b2f22baea0cd802a610d6c
M +3 -3 src/Gui/ComposeWidget.cpp
http://commits.kde.org/trojita/2506900e3ccd43a8b6c0fdff79333ded43edc6dc
diff --git a/src/Gui/ComposeWidget.cpp b/src/Gui/ComposeWidget.cpp
index 172cdd1..6f3dd1c 100644
--- a/src/Gui/ComposeWidget.cpp
+++ b/src/Gui/ComposeWidget.cpp
@@ -1169,13 +1169,13 @@ void ComposeWidget::completeRecipients(const QString &text)
return; // we do not suggest "nothing"
}
Q_ASSERT(sender());
- QLineEdit *toEdit = static_cast<QLineEdit*>(sender());
+ QLineEdit *toEdit = qobject_cast<QLineEdit*>(sender());
+ Q_ASSERT(toEdit);
QStringList contacts = m_mainWindow->addressBook()->complete(text, QStringList(), m_completionCount);
if (contacts.isEmpty() && m_completionPopup) {
m_completionPopup->close();
m_completionReceiver = 0;
- }
- else {
+ } else {
m_completionReceiver = toEdit;
m_completionPopup->setUpdatesEnabled(false);
m_completionPopup->clear();
More information about the kde-doc-english
mailing list