Skip to content

Commit

Permalink
Fix bug where DTO would throw exception due to empty forecast.
Browse files Browse the repository at this point in the history
  • Loading branch information
rugaard committed Nov 9, 2019
1 parent 07be301 commit 3951eae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DTO/Pollen.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function parse(array $data) : void
$this->setName($data['name']);

if (isset($data['forecast'])) {
$this->setForecast($data['forecast']);
$this->setForecast((string) $data['forecast']);
}

if (isset($data['readings']) && $data['readings']->count() > 0) {
Expand Down Expand Up @@ -95,7 +95,7 @@ public function getName() : string
*/
public function setForecast(string $forecast) : self
{
$this->forecast = $forecast;
$this->forecast = !empty($forecast) ? $forecast : null;
return $this;
}

Expand Down

0 comments on commit 3951eae

Please sign in to comment.