forked from qt-creator/qt-creator
TextEditorWidget: Ensure non-null source is passed to insertFromMimeData
Detected by clazy analyzer. The possible context was TextEditorWidget::dropEvent(). In some branches we ensure that mime is not null, but later we call insertFromMimeData() unconditionally. Change-Id: Iee5138bc19d405050eafc9617d3c2ed123b767c7 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -7847,7 +7847,7 @@ struct MappedText
|
||||
|
||||
void TextEditorWidget::insertFromMimeData(const QMimeData *source)
|
||||
{
|
||||
if (isReadOnly())
|
||||
if (!source || isReadOnly())
|
||||
return;
|
||||
|
||||
QString text = source->text();
|
||||
@@ -7857,7 +7857,6 @@ void TextEditorWidget::insertFromMimeData(const QMimeData *source)
|
||||
if (d->m_codeAssistant.hasContext())
|
||||
d->m_codeAssistant.destroyContext();
|
||||
|
||||
|
||||
if (d->m_snippetOverlay->isVisible() && (text.contains('\n') || text.contains('\t')))
|
||||
d->m_snippetOverlay->accept();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user