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:
Sam Carlberg
2018-12-07 22:38:22 -05:00
committed by Peter Johnson
parent 3d546428ab
commit 97ba195b88
5 changed files with 24 additions and 8 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}
}
/**