Add null pointer check

The detailsText widget might be nullptr even if detailsButton is not.
Both are tested elsewhere in code, e.g. in the _q_buttonClicked
private slot, so be consistent.

Address static analyzer warning 00b85157447772462c3b8ffc1da0ae3a

Change-Id: Ib8c31b79653a6e8a9011692cb84ffaa2fb8047e7
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Volker Hilsheimer 2021-02-23 14:22:38 +01:00
parent 1f6dbbd539
commit 88d8309290
1 changed files with 1 additions and 1 deletions

View File

@ -2043,7 +2043,7 @@ int QMessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon ico
void QMessageBoxPrivate::retranslateStrings()
{
#if QT_CONFIG(textedit)
if (detailsButton)
if (detailsButton && detailsText)
detailsButton->setLabel(detailsText->isHidden() ? ShowLabel : HideLabel);
#endif
}