diff --git a/model/DataObject.php b/model/DataObject.php index 5fff3f39a..84d6f5dac 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -3071,8 +3071,11 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity $relations = explode('.', $fieldName); $fieldName = array_pop($relations); foreach($relations as $relation) { + // Bail if the component is null + if(!$component) { + return null; // Inspect $component for element $relation - if($component->hasMethod($relation)) { + } elseif($component->hasMethod($relation)) { // Check nested method $component = $component->$relation(); } elseif($component instanceof SS_List) {