Bugfix: SSViewer check object exists before calling prop or method

This commit is contained in:
Chris Penny 2022-11-24 13:18:56 +13:00
parent dc98cad48a
commit 31d5aef520

View File

@ -355,7 +355,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope
// Check if the method to-be-called exists on the target object - if so, don't check any further
// injection locations
$on = $this->itemIterator ? $this->itemIterator->current() : $this->item;
if (isset($on->$property) || method_exists($on, $property ?? '')) {
if ($on && (isset($on->$property) || method_exists($on, $property ?? ''))) {
return null;
}