diff --git a/ntcore/src/main/native/include/networktables/StructArrayTopic.h b/ntcore/src/main/native/include/networktables/StructArrayTopic.h index 667570bd7e..c4f0083688 100644 --- a/ntcore/src/main/native/include/networktables/StructArrayTopic.h +++ b/ntcore/src/main/native/include/networktables/StructArrayTopic.h @@ -312,6 +312,9 @@ class StructArrayPublisher : public Publisher { void Set(std::span value, int64_t time = 0) { std::apply( [&](const I&... info) { + if (!m_schemaPublished.exchange(true, std::memory_order_relaxed)) { + GetTopic().GetInstance().template AddStructSchema(info...); + } m_buf.Write( value, [&](auto bytes) { ::nt::SetRaw(m_pubHandle, bytes, time); }, @@ -356,6 +359,9 @@ class StructArrayPublisher : public Publisher { void SetDefault(std::span value) { std::apply( [&](const I&... info) { + if (!m_schemaPublished.exchange(true, std::memory_order_relaxed)) { + GetTopic().GetInstance().template AddStructSchema(info...); + } m_buf.Write( value, [&](auto bytes) { ::nt::SetDefaultRaw(m_pubHandle, bytes); },