Skip to content

Commit 6a555b8

Browse files
committed
Simplify remaining bytes checks when retrieving double or float from MultiBuffer
1 parent c46ebc5 commit 6a555b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/maxmind/db/MultiBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public double getDouble() {
150150
ByteBuffer buf = buffers.get(bufIndex).duplicate();
151151
buf.position(off);
152152
double value;
153-
if (off + 8 <= buf.remaining()) {
153+
if (buf.remaining() >= 8) {
154154
value = buf.getDouble();
155155
position += 8;
156156
return value;
@@ -169,7 +169,7 @@ public float getFloat() {
169169
ByteBuffer buf = buffers.get(bufIndex).duplicate();
170170
buf.position(off);
171171
float value;
172-
if (off + 4 <= buf.remaining()) {
172+
if (buf.remaining() >= 4) {
173173
value = buf.getFloat();
174174
position += 4;
175175
return value;

0 commit comments

Comments
 (0)