BUG Fix : relObject() should return null if one of the node is null

This commit is contained in:
Jason 2016-10-21 11:36:16 +11:00 committed by GitHub
parent 0f8f9f2732
commit 8e5bb6fbdc
1 changed files with 4 additions and 1 deletions

View File

@ -3069,8 +3069,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) {