From aecbcb08fc149d029a3134a359c818430175d8da Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 1 Oct 2023 06:43:18 -0700 Subject: [PATCH] [ntcore] Correctly start DataLog for existing publishers (#5703) --- ntcore/src/main/native/cpp/LocalStorage.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ntcore/src/main/native/cpp/LocalStorage.cpp b/ntcore/src/main/native/cpp/LocalStorage.cpp index da87b70582..ecece47761 100644 --- a/ntcore/src/main/native/cpp/LocalStorage.cpp +++ b/ntcore/src/main/native/cpp/LocalStorage.cpp @@ -1450,13 +1450,12 @@ NT_DataLogger LocalStorage::StartDataLog(wpi::log::DataLog& log, } topic->datalogs.emplace_back(log, datalogger->Start(topic.get(), now), datalogger->handle); + topic->datalogType = topic->type; // log current value, if any - if (!topic->lastValue) { - continue; + if (topic->lastValue) { + topic->datalogs.back().Append(topic->lastValue); } - topic->datalogType = topic->type; - topic->datalogs.back().Append(topic->lastValue); } return datalogger->handle;