Skip to content

Commit 85a0a11

Browse files
committed
Fixed EOF error
1 parent 8658370 commit 85a0a11

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ip2location.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ var usagetype_position = [26]uint8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144144
var addresstype_position = [26]uint8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21}
145145
var category_position = [26]uint8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22}
146146

147-
const api_version string = "9.4.0"
147+
const api_version string = "9.4.1"
148148

149149
var max_ipv4_range = big.NewInt(4294967295)
150150
var max_ipv6_range = big.NewInt(0)
@@ -327,7 +327,7 @@ func (d *DB) readstr(pos uint32) (string, error) {
327327
var retval string
328328
data := make([]byte, readlen)
329329
_, err := d.f.ReadAt(data, pos2)
330-
if err != nil {
330+
if err != nil && err.Error() != "EOF" { // bypass EOF error coz we are reading 256 which may hit EOF
331331
return "", err
332332
}
333333
strlen := data[0]
@@ -902,7 +902,6 @@ func (d *DB) query(ipaddress string, mode uint32) (IP2Locationrecord, error) {
902902

903903
ipto32 := d.readuint32_row(fullrow, colsize)
904904
ipto = big.NewInt(int64(ipto32))
905-
906905
} else {
907906
ipfrom = d.readuint128_row(fullrow, 0)
908907

0 commit comments

Comments
 (0)