From afb345915dd5da7b40ef8c8303f901786fcb9099 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 2 Aug 2019 19:14:57 -0400 Subject: [PATCH] linkcatkeys: Avoid discarding potential error values. Spotted by Clang and the [[nodiscard]] patch. --- src/tools/locale/linkcatkeys.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tools/locale/linkcatkeys.cpp b/src/tools/locale/linkcatkeys.cpp index bb3aec6f28..88fb205bf1 100644 --- a/src/tools/locale/linkcatkeys.cpp +++ b/src/tools/locale/linkcatkeys.cpp @@ -127,8 +127,9 @@ main(int argc, char **argv) case TARGET_ATTRIBUTE: { BEntry entry(outputFile.String()); entry_ref eref; - entry.GetRef(&eref); - res = targetCatImpl.WriteToAttribute(eref); + res = entry.GetRef(&eref); + if (res == B_OK) + res = targetCatImpl.WriteToAttribute(eref); if (res != B_OK) { fprintf(stderr, "couldn't write target-attribute to %s - error: %s\n", @@ -140,8 +141,9 @@ main(int argc, char **argv) case TARGET_RESOURCE: { BEntry entry(outputFile.String()); entry_ref eref; - entry.GetRef(&eref); - res = targetCatImpl.WriteToResource(eref); + res = entry.GetRef(&eref); + if (res == B_OK) + res = targetCatImpl.WriteToResource(eref); if (res != B_OK) { fprintf(stderr, "couldn't write target-resource to %s - error: %s\n",