1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-13 12:05:21 +02:00

[207785] NPE when trying to send char while no longer connected

This commit is contained in:
Martin Oberhuber 2007-10-30 23:19:13 +00:00
parent 02f20b5086
commit 0334a2e1ed

View file

@ -16,6 +16,7 @@
* Martin Oberhuber (Wind River) - [206892] State handling: Only allow connect when CLOSED
* Martin Oberhuber (Wind River) - [206883] Serial Terminal leaks Jobs
* Martin Oberhuber (Wind River) - [208145] Terminal prints garbage after quick disconnect/reconnect
* Martin Oberhuber (Wind River) - [207785] NPE when trying to send char while no longer connected
*******************************************************************************/
package org.eclipse.tm.internal.terminal.emulator;
@ -419,7 +420,11 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
protected void sendChar(char chKey, boolean altKeyPressed) {
try {
int byteToSend = chKey;
OutputStream os = getOutputStream();
if (os==null) {
// Bug 207785: NPE when trying to send char while no longer connected
Logger.log("NOT sending '" + byteToSend + "' because no longer connected"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
if (altKeyPressed) {
// When the ALT key is pressed at the same time that a character is
// typed, translate it into an ESCAPE followed by the character. The
@ -438,8 +443,8 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
Logger.log("sending '" + byteToSend + "'"); //$NON-NLS-1$ //$NON-NLS-2$
getOutputStream().write(byteToSend);
}
getOutputStream().flush();
}
} catch (SocketException socketException) {
Logger.logException(socketException);