Skip to content

Commit

Permalink
handle nulls when calling setTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
nateiler committed May 24, 2018
1 parent 263c3fd commit 01a2fd7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion src/elements/traits/TypesAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 01a2fd7

Please sign in to comment.