mirror of
https://github.com/Radarr/Radarr
synced 2025-12-06 16:32:36 +01:00
Fixed: Movie Details crashing on invalid collection
This commit is contained in:
parent
89666175a6
commit
4c8da09df6
1 changed files with 7 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import MonitorToggleButton from 'Components/MonitorToggleButton';
|
|||
import { toggleCollectionMonitored } from 'Store/Actions/movieCollectionActions';
|
||||
import { createCollectionSelectorForHook } from 'Store/Selectors/createCollectionSelector';
|
||||
import MovieCollection from 'typings/MovieCollection';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import styles from './MovieCollectionLabel.css';
|
||||
|
||||
interface MovieCollectionLabelProps {
|
||||
|
|
@ -16,7 +17,8 @@ function MovieCollectionLabel({ tmdbId }: MovieCollectionLabelProps) {
|
|||
monitored,
|
||||
title,
|
||||
isSaving = false,
|
||||
} = useSelector(createCollectionSelectorForHook(tmdbId)) as MovieCollection;
|
||||
} = useSelector(createCollectionSelectorForHook(tmdbId)) ||
|
||||
({} as MovieCollection);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
|
|
@ -29,6 +31,10 @@ function MovieCollectionLabel({ tmdbId }: MovieCollectionLabelProps) {
|
|||
[id, dispatch]
|
||||
);
|
||||
|
||||
if (!id) {
|
||||
return translate('Unknown');
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<MonitorToggleButton
|
||||
|
|
|
|||
Loading…
Reference in a new issue