From 01a2fd7525d6943996e9dd3ee9fa79bcd85f58d3 Mon Sep 17 00:00:00 2001 From: Nate Iler Date: Thu, 24 May 2018 12:16:50 -0600 Subject: [PATCH] handle nulls when calling setTypes --- CHANGELOG.md | 3 ++- src/elements/traits/TypesAttribute.php | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c672f2c..0262513 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ Changelog ========= ## Unreleased ### Fixed +- Error when passed attempting to set types on an organization with a null value - Removing user from organization was causing an error -- Fix organization type urls on listing page and handle slug on detail page +- Organization type urls on listing page and handle slug on detail page ## 1.0.0-rc.11 - 2018-05-17 ### Fixed diff --git a/src/elements/traits/TypesAttribute.php b/src/elements/traits/TypesAttribute.php index a2cb1af..d58b2fc 100644 --- a/src/elements/traits/TypesAttribute.php +++ b/src/elements/traits/TypesAttribute.php @@ -134,7 +134,15 @@ public function setTypes($types) // Remove all types $this->types->setCachedResult([]); - return $this->addTypes($types); + if (!empty($types)) { + if (!is_array($types)) { + $types = [$types]; + } + + $this->addTypes($types); + } + + return $this; } /**