Commit af333649 authored by Guy Thouret's avatar Guy Thouret

(fix) Add extra checks for if getSubtype is callable on an entity and if no...

(fix) Add extra checks for if getSubtype is callable on an entity and if no attachment present to propagate to - Fixes #904
1 merge request!348(fix) Call to a member function getSubtype() on null in PropagateProperties
Pipeline #85507645 passed with stages
in 10 minutes and 29 seconds
......@@ -97,7 +97,7 @@ class PropagateProperties
{
$this->changed = false;
$attachment = $this->entitiesBuilder->single($activity->get('entity_guid'));
if ($attachment === false) {
if (empty($attachment)) {
return;
}
......
......@@ -55,7 +55,15 @@ abstract class Properties
}
if ($this->actsOnType === [] || in_array($entity->getType(), $this->actsOnType, true)) {
return $this->actsOnSubtype === [] || in_array($entity->getSubtype(), $this->actsOnSubtype, true);
if ($this->actsOnSubtype === []) {
return true;
}
if (!is_callable([$entity, 'getSubtype'], true)) {
return false;
}
return in_array($entity->getSubtype(), $this->actsOnSubtype, true);
}
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment