diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index a59b4000..1fcf1370 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3776,7 +3776,11 @@ class SSH2 */ function getLastError() { - return $this->errors[count($this->errors) - 1]; + $count = count($this->errors); + + if ($count > 0) { + return $this->errors[$count - 1]; + } } /**