From 43b394dfdc1e1b17b3e698fc08d92ed6e15db6d6 Mon Sep 17 00:00:00 2001 From: Steveice10 Date: Tue, 21 Apr 2020 12:08:50 -0700 Subject: [PATCH] Check if DNS lookup result is null. --- .../com/github/steveice10/packetlib/tcp/TcpClientSession.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/steveice10/packetlib/tcp/TcpClientSession.java b/src/main/java/com/github/steveice10/packetlib/tcp/TcpClientSession.java index 7f993781..a67a19d0 100644 --- a/src/main/java/com/github/steveice10/packetlib/tcp/TcpClientSession.java +++ b/src/main/java/com/github/steveice10/packetlib/tcp/TcpClientSession.java @@ -106,7 +106,7 @@ public class TcpClientSession extends TcpSession { try { Record[] records = new Lookup(getPacketProtocol().getSRVRecordPrefix() + "._tcp." + host, Type.SRV).run(); - if(records.length > 0) { + if(records != null && records.length > 0) { SRVRecord srv = (SRVRecord) records[0]; host = srv.getTarget().toString().replaceFirst("\\.$", "");