mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Fix LiveWindow attempting to start listeners on uninitialized sendables (#1463)
Additionally adds a defensive check in SendableBuilderImpl to avoid the NPE.
This commit is contained in:
committed by
Peter Johnson
parent
3d546428ab
commit
97ba195b88
@@ -65,6 +65,9 @@ public class LiveWindow {
|
||||
*/
|
||||
public static synchronized void setEnabled(boolean enabled) {
|
||||
if (liveWindowEnabled != enabled) {
|
||||
startLiveWindow = enabled;
|
||||
liveWindowEnabled = enabled;
|
||||
updateValues(); // Force table generation now to make sure everything is defined
|
||||
Scheduler scheduler = Scheduler.getInstance();
|
||||
if (enabled) {
|
||||
System.out.println("Starting live window mode.");
|
||||
@@ -77,8 +80,6 @@ public class LiveWindow {
|
||||
}
|
||||
scheduler.enable();
|
||||
}
|
||||
startLiveWindow = enabled;
|
||||
liveWindowEnabled = enabled;
|
||||
enabledEntry.setBoolean(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,9 @@ public class SendableBuilderImpl implements SendableBuilder {
|
||||
for (Property property : m_properties) {
|
||||
property.startListener();
|
||||
}
|
||||
m_controllableEntry.setBoolean(true);
|
||||
if (m_controllableEntry != null) {
|
||||
m_controllableEntry.setBoolean(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +119,9 @@ public class SendableBuilderImpl implements SendableBuilder {
|
||||
for (Property property : m_properties) {
|
||||
property.stopListener();
|
||||
}
|
||||
m_controllableEntry.setBoolean(false);
|
||||
if (m_controllableEntry != null) {
|
||||
m_controllableEntry.setBoolean(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user