Skip to content

Commit 9a380ea

Browse files
committed
Fix coverity errors
WE2-1003 Signed-off-by: Raul Metsma <[email protected]>
1 parent 632830c commit 9a380ea

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/ui/webeiddialog.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ void WebEidDialog::onVerifyPinFailed(const VerifyPinFailed::Status status, const
478478
break;
479479
case Status::UNKNOWN_ERROR:
480480
message = [] { return tr("Technical error"); };
481-
displayFatalError(message);
481+
displayFatalError(std::move(message));
482482
return;
483483
}
484484

@@ -682,14 +682,15 @@ void WebEidDialog::displayPinBlockedError()
682682
displayFatalError([] { return tr("PIN is locked. Unblock and try again."); });
683683
}
684684

685-
void WebEidDialog::displayFatalError(std::function<QString()> message)
685+
template <typename Text>
686+
void WebEidDialog::displayFatalError(Text message)
686687
{
687688
ui->pinTitleLabel->hide();
688689
ui->pinInput->hide();
689690
ui->pinTimeoutTimer->stop();
690691
ui->pinTimeRemaining->hide();
691692
ui->pinEntryTimeoutProgressBar->hide();
692-
setTrText(ui->pinErrorLabel, message);
693+
setTrText(ui->pinErrorLabel, std::forward<Text>(message));
693694
ui->pinErrorLabel->show();
694695
ui->okButton->hide();
695696
ui->cancelButton->setEnabled(true);

src/ui/webeiddialog.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ class WebEidDialog final : public WebEidUI
104104
template <typename Func>
105105
void setupOK(Func func, const char* text = {}, bool enabled = false);
106106
void displayPinBlockedError();
107-
void displayFatalError(std::function<QString()> message);
107+
template <typename Text>
108+
void displayFatalError(Text message);
108109

109110
void showPinInputWarning(bool show);
110111
void resizeHeight();

0 commit comments

Comments
 (0)