From 88d830929015e085a5532948170bebcdede98bb8 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 23 Feb 2021 14:22:38 +0100 Subject: 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 Reviewed-by: Richard Moe Gustavsen --- src/widgets/dialogs/qmessagebox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/dialogs') diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index b73b3c320d..2bc7acc23d 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -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 } -- cgit v1.2.3