From 8cbce6a0b8c78020fda07d26f842c592bf0cd642 Mon Sep 17 00:00:00 2001 From: Evan Saulpaugh Date: Tue, 7 Jan 2020 16:03:31 -0800 Subject: [PATCH] minor refactor --- .../esaulpaugh/headlong/rlp/RLPDecoder.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/esaulpaugh/headlong/rlp/RLPDecoder.java b/src/main/java/com/esaulpaugh/headlong/rlp/RLPDecoder.java index 5a31070f7..d2eafd16b 100644 --- a/src/main/java/com/esaulpaugh/headlong/rlp/RLPDecoder.java +++ b/src/main/java/com/esaulpaugh/headlong/rlp/RLPDecoder.java @@ -53,19 +53,19 @@ public Iterator sequenceIterator(byte[] buffer, int index) { @Override public boolean hasNext() { - if(next != null) { + if (next != null) { return true; } - if(index >= buffer.length) { - return false; - } - try { - next = decoder.wrap(buffer, index); - this.index = next.endIndex; - return true; - } catch (DecodeException de) { - throw noSuchElementException(de); + if (index < buffer.length) { + try { + next = decoder.wrap(buffer, index); + this.index = next.endIndex; + return true; + } catch (DecodeException de) { + throw noSuchElementException(de); + } } + return false; } }; }