Changeset 75

Show
Ignore:
Timestamp:
12/15/06 01:47:07 (2 years ago)
Author:
mikey
Message:

bugfix: prevent errors in case factory method does not return an instance of an object

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/XJConf/converters/FactoryMethodValueConverter.php

    r70 r75  
    7777        } 
    7878 
    79         // add attributes and child elements 
    80         if ($def instanceof TagDefinition) { 
    81             $this->addAttributesToValue($tag, $def, $instance); 
    82             $this->addCDataToValue($tag, $def, $instance); 
     79        if (null != $instance && get_class($instance) !== false) { 
     80            // add attributes and child elements 
     81            if ($def instanceof TagDefinition) { 
     82                $this->addAttributesToValue($tag, $def, $instance); 
     83                $this->addCDataToValue($tag, $def, $instance); 
     84            } 
     85            $this->addChildrenToValue($tag, $def, $instance, $factoryMethod->getUsedChildrenNames()); 
    8386        } 
    84         $this->addChildrenToValue($tag, $def, $instance, $factoryMethod->getUsedChildrenNames()); 
    8587 
    8688        return $instance;