From 1dfce1c5d3a9102021322559085bd69f49c981cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 21 Aug 2009 21:55:43 +0000 Subject: [PATCH] Much simplier and with is_null() sanity check --- inc/classes/main/helper/class_BaseHelper.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/inc/classes/main/helper/class_BaseHelper.php b/inc/classes/main/helper/class_BaseHelper.php index da4f6b12..5cd4ea88 100644 --- a/inc/classes/main/helper/class_BaseHelper.php +++ b/inc/classes/main/helper/class_BaseHelper.php @@ -438,15 +438,17 @@ class BaseHelper extends BaseFrameworkSystem { * * @param $fieldName Name of the field we shall fetch * @return $fieldValue Value from field + * @throws NullPointerException Thrown if $valueInstance is null */ public function getValueField ($fieldName) { - // Construct the eval() command - $eval = sprintf("\$fieldValue = \$this->getValueInstance()->getField('%s');", - $fieldName - ); + // The $valueInstance attribute should not be null! + if (is_null($this->getValueInstance())) { + // Throws an exception here + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } // END - if // Get the field value - eval($eval); + $fieldValue = $this->getValueInstance()->getField($fieldName); // Return it return $fieldValue; -- 2.30.2