From 84cbd48d84fe6c5db9e0cd8f98e4ac2c6c7f44e1 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 5 Feb 2023 11:57:09 -0800 Subject: [PATCH] [ntcore] Handle excludeSelf on SetDefault (#5058) --- ntcore/src/main/native/cpp/LocalStorage.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ntcore/src/main/native/cpp/LocalStorage.cpp b/ntcore/src/main/native/cpp/LocalStorage.cpp index 3d54a4d41e..ec0d441458 100644 --- a/ntcore/src/main/native/cpp/LocalStorage.cpp +++ b/ntcore/src/main/native/cpp/LocalStorage.cpp @@ -1230,6 +1230,10 @@ PublisherData* LSImpl::PublishEntry(EntryData* entry, NT_Type type) { // create publisher entry->publisher = AddLocalPublisher(entry->topic, wpi::json::object(), entry->subscriber->config); + // exclude publisher if requested + if (entry->subscriber->config.excludeSelf) { + entry->subscriber->config.excludePublisher = entry->publisher->handle; + } return entry->publisher; } @@ -1282,9 +1286,6 @@ bool LSImpl::SetEntryValue(NT_Handle pubentryHandle, const Value& value) { if (!publisher) { if (auto entry = m_entries.Get(pubentryHandle)) { publisher = PublishEntry(entry, value.type()); - if (entry->subscriber->config.excludeSelf) { - entry->subscriber->config.excludePublisher = publisher->handle; - } } if (!publisher) { return false;