Skip to content

Commit c8e33ee

Browse files
committed
Properly compare against MIN/MAX_VALUE
1 parent 545966a commit c8e33ee

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/DoubleArgumentPropertySerializer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public DoubleArgumentType deserialize(ByteBuf buf) {
2424

2525
@Override
2626
public void serialize(DoubleArgumentType object, ByteBuf buf) {
27-
boolean hasMinimum = object.getMinimum() != Double.MIN_VALUE;
28-
boolean hasMaximum = object.getMaximum() != Double.MAX_VALUE;
27+
boolean hasMinimum = Double.compare(object.getMinimum(), Double.MIN_VALUE) != 0;
28+
boolean hasMaximum = Double.compare(object.getMaximum(), Double.MAX_VALUE) != 0;
2929
byte flag = getFlags(hasMinimum, hasMaximum);
3030

3131
buf.writeByte(flag);

proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/FloatArgumentPropertySerializer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public FloatArgumentType deserialize(ByteBuf buf) {
2525

2626
@Override
2727
public void serialize(FloatArgumentType object, ByteBuf buf) {
28-
boolean hasMinimum = object.getMinimum() != Float.MIN_VALUE;
29-
boolean hasMaximum = object.getMaximum() != Float.MAX_VALUE;
28+
boolean hasMinimum = Float.compare(object.getMinimum(), Float.MIN_VALUE) != 0;
29+
boolean hasMaximum = Float.compare(object.getMaximum(), Float.MAX_VALUE) != 0;
3030
byte flag = getFlags(hasMinimum, hasMaximum);
3131

3232
buf.writeByte(flag);

0 commit comments

Comments
 (0)