Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CameraServerWidget: Explicitly unbox Number objects #780

Merged
merged 3 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@Description(
group = "edu.wpi.first.shuffleboard",
name = "CameraServer",
version = "3.1.0",
version = "3.1.1",
summary = "Provides sources and widgets for viewing CameraServer MJPEG streams"
)
@Requires(group = "edu.wpi.first.shuffleboard", name = "NetworkTables", minVersion = "2.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,12 @@ private void applySettings() {
if (getSource() instanceof CameraServerSource) {
CameraServerSource source = (CameraServerSource) getSource();
int compression = (int) compressionSlider.getValue();
int fps = frameRateField.getNumber();
int width = this.width.getNumber();
int height = this.height.getNumber();
// Gson uses an internal subclass of Number that can't be implicitly cast to Integer,
// and Java *really* likes implicitly casting to Integer,
// so we need to explcitly cast to Number.
int fps = ((Number) frameRateField.getNumber()).intValue();
int width = ((Number) this.width.getNumber()).intValue();
int height = ((Number) this.height.getNumber()).intValue();
boolean change = source.getTargetCompression() != compression
|| source.getTargetFps() != fps
|| source.getTargetResolution().isNotEqual(width, height);
Expand Down