diff --git a/src/backend/PatchRecordComponent.cpp b/src/backend/PatchRecordComponent.cpp index c418eb5fed..e9aeff78ac 100644 --- a/src/backend/PatchRecordComponent.cpp +++ b/src/backend/PatchRecordComponent.cpp @@ -143,24 +143,26 @@ void PatchRecordComponent::flush( void PatchRecordComponent::read() { - Parameter aRead; - - aRead.name = "unitSI"; - IOHandler()->enqueue(IOTask(this, aRead)); - IOHandler()->flush(internal::defaultFlushParams); - if (auto val = Attribute(*aRead.resource).getOptional(); - val.has_value()) - setUnitSI(val.value()); - else - throw error::ReadError( - error::AffectedObject::Attribute, - error::Reason::UnexpectedContent, - {}, - "Unexpected Attribute datatype for 'unitSI' (expected double, " - "found " + - datatypeToString(Attribute(*aRead.resource).dtype) + ")"); - readAttributes(ReadMode::FullyReread); // this will set dirty() = false + + if (containsAttribute("unitSI")) + { + if (auto val = getAttribute("unitSI").getOptional(); + val.has_value()) + { + setUnitSI(val.value()); + } + else + { + throw error::ReadError( + error::AffectedObject::Attribute, + error::Reason::UnexpectedContent, + {}, + "Unexpected Attribute datatype for 'unitSI' (expected double, " + "found " + + datatypeToString(getAttribute("unitSI").dtype) + ")"); + } + } } bool PatchRecordComponent::dirtyRecursive() const