diff --git a/src/clientP2P/ClientManagement.java b/src/clientP2P/ClientManagement.java index 637ff44..f10d51d 100644 --- a/src/clientP2P/ClientManagement.java +++ b/src/clientP2P/ClientManagement.java @@ -182,6 +182,9 @@ public abstract class ClientManagement extends ServeErrors implements Runnable { * @throws VersionRemoteError */ protected String[] listDirectory() throws EmptyDirectory, InternalError, UnknownHostException, IOException, TransmissionError, ProtocolError, VersionError, SizeError, InternalRemoteError, ProtocolRemoteError, VersionRemoteError { + if (hostList.size() == 0) { + return new String[0]; + } ProtocolP2PPacket d = createProtocolP2PPacket(new Payload(RequestResponseCode.LIST_REQUEST)); try { d.sendRequest(getHostItemSocket(hostList.get(0)));