From 3cba7254a84cfee6468af54bdcae28b4ebcbe852 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 25 Jan 2020 22:52:50 +0100 Subject: [PATCH] DeskCalc: fix gcc8 build. --- src/apps/deskcalc/CalcView.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/apps/deskcalc/CalcView.cpp b/src/apps/deskcalc/CalcView.cpp index a2d3224018..a845ccf100 100644 --- a/src/apps/deskcalc/CalcView.cpp +++ b/src/apps/deskcalc/CalcView.cpp @@ -802,19 +802,23 @@ void CalcView::Copy() { // access system clipboard - if (be_clipboard->Lock()) { - BMessage* clipper; - if (be_clipboard->Clear() == B_OK - && (clipper = be_clipboard->Data()) == B_OK) { - BString expression = fExpressionTextView->Text(); - if (clipper->AddData("text/plain", B_MIME_TYPE, - expression.String(), expression.Length()) == B_OK) { - clipper->what = B_MIME_DATA; - be_clipboard->Commit(); - } - } - be_clipboard->Unlock(); + if (!be_clipboard->Lock()) + return; + if (be_clipboard->Clear() != B_OK) + return; + + BMessage* clipper; + clipper = be_clipboard->Data(); + if (clipper == NULL) + return; + + BString expression = fExpressionTextView->Text(); + if (clipper->AddData("text/plain", B_MIME_TYPE, + expression.String(), expression.Length()) == B_OK) { + clipper->what = B_MIME_DATA; + be_clipboard->Commit(); } + be_clipboard->Unlock(); }