mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-22 18:20:31 -05:00
(Fix) Handle null release_date with collection movies (#5263)
* (Fix) Handle null release_date with collection movies
The movie-meta.blade throws a "Call to a member function format() on null" error when displaying any item that is a part of a collection when one item in that collection lacks a release date.
Changed $movie->release_date->format('Y') to substr($movie->release_date ?? '', 0, 4) to match the same date handling format used elsewhere in the file.
NOTE: This will leave the empty parentheses when release_date is null. This is a pretty obscure edge case so the stability of matching existing patterns is probably preferable. Alternatively, the line could be wrapped in a ternary to also hide parentheses.
* (Fix) null-safe operator for movie release_date
This commit is contained in:
@@ -366,13 +366,13 @@
|
||||
<h3 class="meta-chip__value">
|
||||
<strong>
|
||||
{{ $movie->title }}
|
||||
({{ $movie->release_date->format('Y') }})
|
||||
({{ $movie->release_date?->format('Y') }})
|
||||
</strong>
|
||||
</h3>
|
||||
@else
|
||||
<h3 class="meta-chip__value">
|
||||
{{ $movie->title }}
|
||||
({{ $movie->release_date->format('Y') }})
|
||||
({{ $movie->release_date?->format('Y') }})
|
||||
</h3>
|
||||
@endif
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user