Fixed #6922 - date_add crashing if EOL is null

This commit is contained in:
snipe 2019-04-18 15:49:59 -04:00
parent 420e8bc85a
commit 1bb1f7342f

View file

@ -391,7 +391,7 @@ class AssetPresenter extends Presenter
public function eol_date() public function eol_date()
{ {
if (( $this->purchase_date ) && ( $this->model )) { if (( $this->purchase_date ) && ( $this->model ) && ($this->model->model->eol) ) {
$date = date_create($this->purchase_date); $date = date_create($this->purchase_date);
date_add($date, date_interval_create_from_date_string($this->model->model->eol . ' months')); date_add($date, date_interval_create_from_date_string($this->model->model->eol . ' months'));
return date_format($date, 'Y-m-d'); return date_format($date, 'Y-m-d');