forked from qt-creator/qt-creator
VariableChooser: Avoid null pointer access
The code makes an effort to qobject_cast a pointer and check it, yet it
accesses another pointer to do its thing.
If the currentWidget is a QPlainTextEdit, this simply crashes.
Amends: da3b83589b
Change-Id: Ie79fa233b04c392fd5aa72cd512fcd0f0d829659
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -469,8 +469,8 @@ void VariableChooserPrivate::updateButtonGeometry()
|
|||||||
int margin = buttonMargin();
|
int margin = buttonMargin();
|
||||||
int rightPadding = 0;
|
int rightPadding = 0;
|
||||||
if (const auto scrollArea = qobject_cast<const QAbstractScrollArea*>(current)) {
|
if (const auto scrollArea = qobject_cast<const QAbstractScrollArea*>(current)) {
|
||||||
rightPadding = m_textEdit->verticalScrollBar()->isVisible() ?
|
rightPadding = scrollArea->verticalScrollBar()->isVisible() ?
|
||||||
m_textEdit->verticalScrollBar()->width() : 0;
|
scrollArea->verticalScrollBar()->width() : 0;
|
||||||
}
|
}
|
||||||
m_iconButton->setGeometry(current->rect().adjusted(
|
m_iconButton->setGeometry(current->rect().adjusted(
|
||||||
current->width() - (margin + 4), 0,
|
current->width() - (margin + 4), 0,
|
||||||
|
Reference in New Issue
Block a user