Skip to content

Commit

Permalink
Fixed #7003 - crash when warranty months or purchase date is null
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed May 7, 2019
1 parent 486c708 commit 23fa5d0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/Presenters/AssetPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,13 @@ public function fullStatusText() {
*/
public function warrantee_expires()
{
$date = date_create($this->purchase_date);
date_add($date, date_interval_create_from_date_string($this->warranty_months . ' months'));
return date_format($date, 'Y-m-d');
if (($this->purchase_date) && ($this->warranty_months)) {
$date = date_create($this->purchase_date);
date_add($date, date_interval_create_from_date_string($this->warranty_months . ' months'));
return date_format($date, 'Y-m-d');
}

return false;
}

/**
Expand Down

0 comments on commit 23fa5d0

Please sign in to comment.