diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-12-15 15:42:05 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-12-15 15:44:21 (GMT) |
commit | 3e7adcb80a86748608d5517413301cd2b1b8df78 (patch) | |
tree | be0032b3074c4b74bd0e2247a24546f53d35e8d4 /demos/textedit | |
parent | 27de60f2f6047cb3f698825af96e569fde04ef06 (diff) | |
download | Qt-3e7adcb80a86748608d5517413301cd2b1b8df78.zip Qt-3e7adcb80a86748608d5517413301cd2b1b8df78.tar.gz Qt-3e7adcb80a86748608d5517413301cd2b1b8df78.tar.bz2 |
Check for null-pointer to avoid a crash in textedit demo.
Task-number: QTBUG-16125
Reviewed-by: trustme
Diffstat (limited to 'demos/textedit')
-rw-r--r-- | demos/textedit/textedit.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp index 165c97c..9fa1949 100644 --- a/demos/textedit/textedit.cpp +++ b/demos/textedit/textedit.cpp @@ -262,7 +262,8 @@ void TextEdit::setupEditActions() tb->addAction(a); menu->addAction(a); #ifndef QT_NO_CLIPBOARD - actionPaste->setEnabled(QApplication::clipboard()->mimeData()->hasText()); + if (const QMimeData *md = QApplication::clipboard()->mimeData()) + actionPaste->setEnabled(md->hasText()); #endif } @@ -681,7 +682,8 @@ void TextEdit::cursorPositionChanged() void TextEdit::clipboardDataChanged() { #ifndef QT_NO_CLIPBOARD - actionPaste->setEnabled(QApplication::clipboard()->mimeData()->hasText()); + if (const QMimeData *md = QApplication::clipboard()->mimeData()) + actionPaste->setEnabled(md->hasText()); #endif } |