From 3fd33b1f7253a6757217292d5eff4e80aa90161d Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Tue, 5 Nov 2024 11:48:24 -0500 Subject: [PATCH] [wpiutil] DynamicStruct: Clear nested fields when updating/adding a schema (#7334) --- wpiutil/src/main/native/cpp/struct/DynamicStruct.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wpiutil/src/main/native/cpp/struct/DynamicStruct.cpp b/wpiutil/src/main/native/cpp/struct/DynamicStruct.cpp index 28e61dacd1..120590d5f4 100644 --- a/wpiutil/src/main/native/cpp/struct/DynamicStruct.cpp +++ b/wpiutil/src/main/native/cpp/struct/DynamicStruct.cpp @@ -199,6 +199,7 @@ const StructDescriptor* StructDescriptorDatabase::Add(std::string_view name, .first->second; theStruct.m_schema = schema; theStruct.m_fields.clear(); + theStruct.m_fieldsByName.clear(); theStruct.m_fields.reserve(parsed.declarations.size()); bool isValid = true; for (auto&& decl : parsed.declarations) {