Fix NPE if end-of-stream encountered during handshake (fixes #195).

This commit is contained in:
Michael Jumper
2012-10-03 10:27:53 -07:00
parent ed4dd27a05
commit 13db41f704

View File

@@ -40,6 +40,7 @@ package net.sourceforge.guacamole.protocol;
import net.sourceforge.guacamole.io.GuacamoleReader;
import net.sourceforge.guacamole.io.GuacamoleWriter;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.GuacamoleServerException;
import net.sourceforge.guacamole.net.GuacamoleSocket;
import net.sourceforge.guacamole.protocol.GuacamoleInstruction.Operation;
@@ -86,7 +87,12 @@ public class ConfiguredGuacamoleSocket implements GuacamoleSocket {
// Wait for server args
GuacamoleInstruction instruction;
do {
// Read instruction, fail if end-of-stream
instruction = reader.readInstruction();
if (instruction == null)
throw new GuacamoleServerException("End of stream during initial handshake.");
} while (instruction.getOperation() != Operation.SERVER_ARGS);
// Build args list off provided names and config