Skip to content

Commit 2fe1aa0

Browse files
committed
IPv4 lookup bug fix
1 parent 19e79dc commit 2fe1aa0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/main/java/com/maxmind/maxminddb/MaxMindDbReader.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ private int ipV4StartNode() throws InvalidDatabaseException {
136136
}
137137
int node = 0;
138138
int nextNode = 0;
139-
for (int i = 0; i < 96 && nextNode < this.metadata.nodeCount; i++) {
140-
node = nextNode;
139+
for (int i = 0; i < 96; i++) {
141140
nextNode = this.readNode(node, 0);
141+
if (nextNode >= this.metadata.nodeCount) {
142+
break;
143+
}
144+
node = nextNode;
142145
}
143146
this.ipV4Start = node;
144147
return node;

0 commit comments

Comments
 (0)