commit | 6142cf3e4336e2401dc0b2af025a55e35f3b29fa | [log] [tgz] |
---|---|---|
author | Guillaume Nodet <gnodet@apache.org> | Mon Mar 21 16:59:28 2016 +0000 |
committer | Guillaume Nodet <gnodet@apache.org> | Mon Mar 21 16:59:28 2016 +0000 |
tree | a9f734a6081ecfcbefe3954de1186fedf7bf6f60 | |
parent | 1b58b18fc5fc4cdae82f3b6d57a280081b2d2fac [diff] |
Avoid possible exceptions with isTty git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1736053 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java index bae9d3b..adb78cd 100644 --- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java +++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java
@@ -203,7 +203,10 @@ public boolean isTty(int fd) { // TODO: this assumes that the session is always created with input/output tty streams - return !toclose[fd]; + if (fd < 0 || fd > streams.length) { + return false; + } + return streams[fd] != null && !toclose[fd]; } public void error(int error) {