From dafa7cc7b5bc35f06f63a78b8f29a7d71fc93f5d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 10 Oct 2016 20:34:54 +0200 Subject: QFileDialog: add missing break statements in switch in labelText() It is of course wrong to potentially return the text of the Cancel button if the text of the Accept role button was asked for. Found independently by GCC 7 and Coverity. Coverity-Id: 11150 Change-Id: Ie30f7875daee16a78eeff4b314ce17cbd7cd3aa8 Reviewed-by: Edward Welbourne --- src/widgets/dialogs/qfiledialog.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets/dialogs/qfiledialog.cpp') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 3aa9052917..61f5f7b0d2 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2042,10 +2042,12 @@ QString QFileDialog::labelText(DialogLabel label) const button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Save); if (button) return button->text(); + break; case Reject: button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel); if (button) return button->text(); + break; } return QString(); } -- cgit v1.2.3