[wpilib] Throw on nonexistent SimDevice name in SimDeviceSim constructor (#5041)

Previously this would just create a object that was otherwise non-functional.
This commit is contained in:
Ryan Blue
2023-02-03 18:18:31 -05:00
committed by GitHub
parent a27a047ae8
commit d991f6e435
2 changed files with 21 additions and 1 deletions

View File

@@ -25,6 +25,9 @@ public class SimDeviceSim {
*/
public SimDeviceSim(String name) {
this(SimDeviceDataJNI.getSimDeviceHandle(name));
if (m_handle == 0) {
throw new IllegalArgumentException("No sim device exists with name '" + name + "'.");
}
}
/**