Skip to content

Commit 54d6c8d

Browse files
committed
Warn when setting default value on non-cached topic
1 parent 3328b0e commit 54d6c8d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ntcore/src/main/native/cpp/LocalStorage.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,11 @@ bool LocalStorage::Impl::SetDefaultEntryValue(NT_Handle pubsubentryHandle,
998998
return false;
999999
}
10001000
if (auto topic = GetTopic(pubsubentryHandle)) {
1001-
if (topic->Cached() && !topic->lastValue &&
1001+
if (!topic->Cached()) {
1002+
WARN("ignoring default value on non-cached topic '{}'", topic->name);
1003+
return false;
1004+
}
1005+
if (!topic->lastValue &&
10021006
(topic->type == NT_UNASSIGNED || topic->type == value.type() ||
10031007
IsNumericCompatible(topic->type, value.type()))) {
10041008
// publish if we haven't yet

0 commit comments

Comments
 (0)