Skip to content

Commit

Permalink
Fixed shuffleboard API crashing from missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Feb 3, 2024
1 parent 73b45fd commit 7e4a5b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/services/shuffleboard_nt_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ class ShuffleboardNTListener {
String componentName = tables[2];

String jsonKey = '$tabName/$componentName';
currentJsonData.putIfAbsent(jsonKey, () => {});

if (!shuffleboardTreeRoot.hasRow(shuffleboardTableRoot.substring(1))) {
return;
Expand Down Expand Up @@ -322,7 +323,7 @@ class ShuffleboardNTListener {
return;
}

bool isLayout = currentJsonData[jsonKey]!['layout'];
bool isLayout = tryCast(currentJsonData[jsonKey]!['layout']) ?? false;

if (isLayout) {
handleLayoutTopicAnnounce(topic, widgetRow);
Expand Down Expand Up @@ -355,7 +356,6 @@ class ShuffleboardNTListener {

String cameraName = cameraStream.substring(16);

currentJsonData.putIfAbsent(jsonKey, () => {});
currentJsonData[jsonKey]!
.putIfAbsent('properties', () => <String, dynamic>{});
currentJsonData[jsonKey]!['properties']['topic'] =
Expand Down

0 comments on commit 7e4a5b3

Please sign in to comment.