Unverified Commit bfbe750e authored by Sebastian Castro's avatar Sebastian Castro
Browse files

Handle null contributions

parent c0c13368
......@@ -994,10 +994,11 @@ class Element
// Sometime the association between Element and Contribution is broken, and so
// need to sensure the contribution exists
// #UglyFix
if (!$this->contributions) return [];
$contribs = [];
foreach ($this->contributions as $contrib) {
try {
if ($contrib->getType() != null) array_push($contribs, $contrib);
if ($contrib->getCreatedAt() != null) array_push($contribs, $contrib);
} catch (\Exception $e) {
$this->removeContribution($contrib);
}
......
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