From 7b59d18363cde726bd18d80571054442671d1a34 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 2 May 2013 21:07:05 +0200 Subject: [PATCH] Prevent missing length from throwing an NPE. --- src/main/java/net/pterodactylus/irc/Connection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/irc/Connection.java b/src/main/java/net/pterodactylus/irc/Connection.java index b67b8db..b1ca64a 100644 --- a/src/main/java/net/pterodactylus/irc/Connection.java +++ b/src/main/java/net/pterodactylus/irc/Connection.java @@ -553,7 +553,7 @@ public class Connection extends AbstractExecutionThreadService implements Servic } } else if (messageWords[1].equalsIgnoreCase("ACCEPT")) { Optional port = Optional.fromNullable(Ints.tryParse(messageWords[3])); - long position = Optional.fromNullable(Longs.tryParse(messageWords[4])).or(-1L); + long position = (messageWords.length > 4) ? Optional.fromNullable(Longs.tryParse(messageWords[4])).or(-1L) : -1; if (port.isPresent()) { eventBus.post(new DccAcceptReceived(this, client, messageWords[2], port.get(), position)); } else { -- 2.7.4