mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10159 from creative-commoners/pulls/4/tmpitem
FIX Ensure tmpItem has a value before calling method_exists on it
This commit is contained in:
commit
1425146dad
@ -146,7 +146,7 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM
|
|||||||
if ($tmpItem instanceof SS_List) {
|
if ($tmpItem instanceof SS_List) {
|
||||||
// It's impossible to sort on a HasManyList/ManyManyList
|
// It's impossible to sort on a HasManyList/ManyManyList
|
||||||
break;
|
break;
|
||||||
} elseif (method_exists($tmpItem, 'hasMethod') && $tmpItem->hasMethod($methodName)) {
|
} elseif ($tmpItem && method_exists($tmpItem, 'hasMethod') && $tmpItem->hasMethod($methodName)) {
|
||||||
// The part is a relation name, so get the object/list from it
|
// The part is a relation name, so get the object/list from it
|
||||||
$tmpItem = $tmpItem->$methodName();
|
$tmpItem = $tmpItem->$methodName();
|
||||||
} elseif ($tmpItem instanceof DataObject
|
} elseif ($tmpItem instanceof DataObject
|
||||||
|
Loading…
Reference in New Issue
Block a user