From 8bb9a45cbb424373857f3cca4a868beea441dc45 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 27 Nov 2009 13:13:52 +1300 Subject: [PATCH] Add some error avoidance to SetLookup. --- inc/classEditor.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inc/classEditor.php b/inc/classEditor.php index 54bab1f6..e6effc05 100644 --- a/inc/classEditor.php +++ b/inc/classEditor.php @@ -25,7 +25,7 @@ class EditorField var $LookupSql; var $OptionList; - function EditorField( $field, $sql="", $lookup_sql="" ) { + function __construct( $field, $sql="", $lookup_sql="" ) { global $session; $this->Field = $field; $this->Sql = $sql; @@ -116,7 +116,7 @@ class Editor var $SubmitName; var $Id; - function Editor( $title = "", $fields = null ) { + function __construct( $title = "", $fields = null ) { global $c, $session, $form_id_increment; $this->Title = $title; $this->Order = ""; @@ -156,7 +156,9 @@ class Editor } function SetLookup( $field, $lookup_sql ) { - $this->Fields[$field]->SetLookup( $lookup_sql ); + if (is_object($this->Fields[$field])) { + $this->Fields[$field]->SetLookup( $lookup_sql ); + } } function Value( $value_field_name ) {