From 4e84fbd4dfa7c11f994bdd67ca2aede7d32640b1 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Thu, 26 Sep 2024 16:54:33 +1200 Subject: [PATCH] ENH Improve type safety to support refactored template layer --- code/Controller/AssetAdmin.php | 4 ++-- code/Forms/FileHistoryFormFactory.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/Controller/AssetAdmin.php b/code/Controller/AssetAdmin.php index 5361ebe5a..0d026ffe5 100644 --- a/code/Controller/AssetAdmin.php +++ b/code/Controller/AssetAdmin.php @@ -710,8 +710,8 @@ public function apiHistory(HTTPRequest $request): HTTPResponse $output[] = array( 'versionid' => (int) $version->Version, - 'date_ago' => $version->dbObject('LastEdited')->Ago(), - 'date_formatted' => $version->dbObject('LastEdited')->Nice(), + 'date_ago' => $version->dbObject('LastEdited')?->Ago(), + 'date_formatted' => $version->dbObject('LastEdited')?->Nice(), 'status' => ($version->WasPublished) ? _t(__CLASS__.'.PUBLISHED', 'Published') : '', 'author' => ($author) ? $author->Name diff --git a/code/Forms/FileHistoryFormFactory.php b/code/Forms/FileHistoryFormFactory.php index 1c90b1f52..b6d2d095b 100644 --- a/code/Forms/FileHistoryFormFactory.php +++ b/code/Forms/FileHistoryFormFactory.php @@ -36,7 +36,7 @@ protected function getSpecsMarkup($record) ? _t(__CLASS__ . '.PUBLISHED', 'Published') : _t(__CLASS__ . '.SAVED', 'Saved'), Convert::raw2att($record->LastEdited), - Convert::raw2xml($record->dbObject('LastEdited')->Ago()) + Convert::raw2xml($record->dbObject('LastEdited')?->Ago()) ); return sprintf( '
%s %s, %s %s
',