From: sam_marshall <sam_marshall>
Date: Thu, 21 May 2009 11:54:43 +0000 (+0000)
Subject: MDL-18051: Fixed errors in evalmath when using grade expressions that begin with... 
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e5e2fc05993c0694d2e4e333314aedcfc38491d0;p=moodle.git

MDL-18051: Fixed errors in evalmath when using grade expressions that begin with bracket
---

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;
     }
 }