summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-12-15 15:42:05 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-12-15 15:44:21 (GMT)
commit3e7adcb80a86748608d5517413301cd2b1b8df78 (patch)
treebe0032b3074c4b74bd0e2247a24546f53d35e8d4 /demos
parent27de60f2f6047cb3f698825af96e569fde04ef06 (diff)
downloadQt-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')
-rw-r--r--demos/textedit/textedit.cpp6
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
}