From f43fdf19c2a65f8d2fc46d06345f38eb55ddb801 Mon Sep 17 00:00:00 2001 From: Anna Dushistova Date: Mon, 1 Oct 2012 18:17:14 +0000 Subject: [PATCH] [386262] fixed NPE in setTerminalSize. --- .../local/LocalTerminalConnector.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java b/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java index ad6b6c70b58..757f04c7212 100644 --- a/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java +++ b/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java @@ -1,14 +1,15 @@ /*************************************************************************************************** - * Copyright (c) 2008, 2010 Mirko Raner and others. + * Copyright (c) 2008, 2012 Mirko Raner and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mirko Raner - [196337] initial implementation; some methods adapted from - * org.eclipse.tm.terminal.ssh/SshConnector - * Mirko Raner - [314977] Dynamically disable when no PTY is available + * Mirko Raner - [196337] initial implementation; some methods adapted from + * org.eclipse.tm.terminal.ssh/SshConnector + * Mirko Raner - [314977] Dynamically disable when no PTY is available + * Anna Dushistova(MontaVista) - [386262] NPE in setTerminalSize **************************************************************************************************/ package org.eclipse.tm.internal.terminal.local; @@ -52,7 +53,7 @@ import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnect * vi editor). * * @author Mirko Raner - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ public class LocalTerminalConnector extends TerminalConnectorImpl implements IDebugEventSetListener { @@ -342,13 +343,14 @@ implements IDebugEventSetListener { * @param height the new terminal height (in lines) */ public void setTerminalSize(int width, int height) { + if(process != null){ + PTY pty = process.getPTY(); + if (pty != null && (width != lastWidth || height != lastHeight)) { - PTY pty = process.getPTY(); - if (pty != null && (width != lastWidth || height != lastHeight)) { - - pty.setTerminalSize(width, height); - lastWidth = width; - lastHeight = height; + pty.setTerminalSize(width, height); + lastWidth = width; + lastHeight = height; + } } }