Skip to content

Commit

Permalink
CameraServerWidget: Explicitly unbox Number objects (#780)
Browse files Browse the repository at this point in the history
  • Loading branch information
Starlight220 authored Mar 28, 2023
1 parent 69b2dc2 commit 42dcd98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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

0 comments on commit 42dcd98

Please sign in to comment.