From 5e89ef9a9f55c8ba2347a7b8f7f6f0fa9e073db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Tue, 25 Jul 2023 19:31:05 +0200 Subject: [PATCH] Follow-up to #1470 (#1482) Changes there left the PatchRecordComponent dirty after parsing --- src/backend/PatchRecordComponent.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/backend/PatchRecordComponent.cpp b/src/backend/PatchRecordComponent.cpp index e9aeff78ac..d5df665084 100644 --- a/src/backend/PatchRecordComponent.cpp +++ b/src/backend/PatchRecordComponent.cpp @@ -147,12 +147,14 @@ void PatchRecordComponent::read() if (containsAttribute("unitSI")) { + /* + * No need to call setUnitSI + * If it's in the attributes map, then it's already set + * Just verify that it has the right type (getOptional<>() does + * conversions if possible, so this check is non-intrusive) + */ if (auto val = getAttribute("unitSI").getOptional(); - val.has_value()) - { - setUnitSI(val.value()); - } - else + !val.has_value()) { throw error::ReadError( error::AffectedObject::Attribute,