From 293d2281c3c331b3c2aa26a3725d27db9310f1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Mon, 24 Jul 2023 15:00:15 +0200 Subject: [PATCH] Follow-up to #1470 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,