keyfield records might be empty
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 2 Sep 2016 08:31:13 +0000 (10:31 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 2 Sep 2016 11:19:41 +0000 (13:19 +0200)
Change-Id: I8d1b8f4f88698dcca4bd42f20b405b67dd4b8aa3
Reviewed-on: http://gerrit.tine20.com/customers/3510
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Config/KeyField.php

index 4900cda..f59395f 100644 (file)
@@ -142,6 +142,10 @@ class Tinebase_Config_KeyField extends Tinebase_Record_Abstract
      */
     public function getValue($id)
     {
+        if (! $this->records instanceof Tinebase_Record_RecordSet) {
+            return '';
+        }
+
         $record = $this->records->filter('id', $id)->getFirstRecord();
         if (! $record) {
             $record = $this->getKeyfieldDefault();
@@ -190,4 +194,4 @@ class Tinebase_Config_KeyField extends Tinebase_Record_Abstract
 
         return $originRecord ? $originRecord->getId() : null;
     }
-}
\ No newline at end of file
+}