From e5e2fc05993c0694d2e4e333314aedcfc38491d0 Mon Sep 17 00:00:00 2001 From: sam_marshall Date: Thu, 21 May 2009 11:54:43 +0000 Subject: [PATCH] MDL-18051: Fixed errors in evalmath when using grade expressions that begin with bracket --- lib/evalmath/evalmath.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/evalmath/evalmath.class.php b/lib/evalmath/evalmath.class.php index 84a74488b6..5af83986bc 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; } } -- 2.39.5