From 86de570dbd33b6ea7a34c1efba4bb8550cda34c0 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 24 Jun 2020 08:38:26 +0200 Subject: [PATCH 1/2] Add const attribute to CGenErr::GetErrorText Signed-off-by: Stefan Weil --- src/global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global.h b/src/global.h index 4a09bc95..20ef60cc 100755 --- a/src/global.h +++ b/src/global.h @@ -282,7 +282,7 @@ public: CGenErr ( QString strNewErrorMsg, QString strNewErrorType = "" ) : strErrorMsg ( strNewErrorMsg ), strErrorType ( strNewErrorType ) {} - QString GetErrorText() + QString GetErrorText() const { // return formatted error text if ( strErrorType.isEmpty() ) From 172593f7b95b6735082bbe9f08388a357e0f10b3 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 24 Jun 2020 08:39:27 +0200 Subject: [PATCH 2/2] Catch a CGenErr by const reference rather than by value This fixes alerts from LGTM. Signed-off-by: Stefan Weil --- src/clientdlg.cpp | 2 +- src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 8a455762..0d2560dd 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -1079,7 +1079,7 @@ void CClientDlg::Connect ( const QString& strSelectedAddress, } } - catch ( CGenErr generr ) + catch ( const CGenErr& generr ) { // show error message and return the function QMessageBox::critical ( this, APP_NAME, generr.GetErrorText(), "Close", nullptr ); diff --git a/src/main.cpp b/src/main.cpp index 251ec0d0..67703a9c 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -706,7 +706,7 @@ int main ( int argc, char** argv ) } } - catch ( CGenErr generr ) + catch ( const CGenErr& generr ) { // show generic error #ifndef HEADLESS