Skip to content

Commit

Permalink
[glass] Check for null entries when updating struct/proto (wpilibsuit…
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson authored Dec 18, 2023
1 parent a004c9e commit f029841
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions glass/src/libnt/native/cpp/NetworkTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,10 @@ void NetworkTablesModel::Update() {
} else if (desc->IsValid()) {
// loop over all entries with this type and update
for (auto&& entryPair : m_entries) {
auto ts = entryPair.second->info.type_str;
if (!entryPair.second) {
continue;
}
std::string_view ts = entryPair.second->info.type_str;
if (!wpi::starts_with(ts, "struct:")) {
continue;
}
Expand All @@ -901,7 +904,10 @@ void NetworkTablesModel::Update() {
} else {
// loop over all protobuf entries and update (conservatively)
for (auto&& entryPair : m_entries) {
auto& ts = entryPair.second->info.type_str;
if (!entryPair.second) {
continue;
}
std::string_view ts = entryPair.second->info.type_str;
if (wpi::starts_with(ts, "proto:")) {
entryPair.second->UpdateFromValue(*this);
}
Expand Down

0 comments on commit f029841

Please sign in to comment.