mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
Fixes exception on camera creation without plugged in camera (#470)
Would throw if the camera was disconnected. We handle this properly at the JNI level to not have this crash the entire program, but the error is still kind of annoying, and not really an error.
This commit is contained in:
committed by
Peter Johnson
parent
b8537be219
commit
ff141ab1ff
@@ -360,9 +360,13 @@ public class CameraServer {
|
||||
CameraServerJNI.getSourceDescription(event.sourceHandle));
|
||||
table.putBoolean("connected", CameraServerJNI.isSourceConnected(event.sourceHandle));
|
||||
table.putStringArray("streams", getSourceStreamValues(event.sourceHandle));
|
||||
VideoMode mode = CameraServerJNI.getSourceVideoMode(event.sourceHandle);
|
||||
table.setDefaultString("mode", videoModeToString(mode));
|
||||
table.putStringArray("modes", getSourceModeValues(event.sourceHandle));
|
||||
try {
|
||||
VideoMode mode = CameraServerJNI.getSourceVideoMode(event.sourceHandle);
|
||||
table.setDefaultString("mode", videoModeToString(mode));
|
||||
table.putStringArray("modes", getSourceModeValues(event.sourceHandle));
|
||||
} catch (VideoException ex) {
|
||||
// Do nothing. Let the other event handlers update this if there is an error.
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kSourceDestroyed: {
|
||||
|
||||
Reference in New Issue
Block a user