diff --git a/lib/evalmath/evalmath.class.php b/lib/evalmath/evalmath.class.php index 84a74488b6d..5af83986bcc 100644 --- a/lib/evalmath/evalmath.class.php +++ b/lib/evalmath/evalmath.class.php @@ -422,7 +422,10 @@ class EvalMathStack { } function last($n=1) { - return $this->stack[$this->count-$n]; + if ($this->count - $n >= 0) { + return $this->stack[$this->count-$n]; + } + return null; } }