Skip to content

Commit

Permalink
Removed panic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ice3man543 committed Jan 22, 2022
1 parent 276055b commit 21ec131
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client.go
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/gob"
"encoding/json"
"errors"
"fmt"
"math/rand"
"net"
"strings"
Expand All @@ -26,7 +27,7 @@ func init() {
var err error
internalRangeCheckerInstance, err = newInternalRangeChecker()
if err != nil {
panic(err)
fmt.Printf("could not initialize range checker: %s\n", err)
}
}

Expand Down Expand Up @@ -419,7 +420,7 @@ func (d *DNSData) ParseFromMsg(msg *dns.Msg) error {
for _, record := range allRecords {
switch recordType := record.(type) {
case *dns.A:
if CheckInternalIPs && internalRangeCheckerInstance.ContainsIPv4(recordType.A) {
if CheckInternalIPs && internalRangeCheckerInstance != nil && internalRangeCheckerInstance.ContainsIPv4(recordType.A) {
d.Internal = true
}
d.A = append(d.A, trimChars(recordType.A.String()))
Expand Down

0 comments on commit 21ec131

Please sign in to comment.