mirror of
https://github.com/Radarr/Radarr
synced 2025-12-06 08:28:50 +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 { toggleCollectionMonitored } from 'Store/Actions/movieCollectionActions';
|
||||||
import { createCollectionSelectorForHook } from 'Store/Selectors/createCollectionSelector';
|
import { createCollectionSelectorForHook } from 'Store/Selectors/createCollectionSelector';
|
||||||
import MovieCollection from 'typings/MovieCollection';
|
import MovieCollection from 'typings/MovieCollection';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
import styles from './MovieCollectionLabel.css';
|
import styles from './MovieCollectionLabel.css';
|
||||||
|
|
||||||
interface MovieCollectionLabelProps {
|
interface MovieCollectionLabelProps {
|
||||||
|
|
@ -16,7 +17,8 @@ function MovieCollectionLabel({ tmdbId }: MovieCollectionLabelProps) {
|
||||||
monitored,
|
monitored,
|
||||||
title,
|
title,
|
||||||
isSaving = false,
|
isSaving = false,
|
||||||
} = useSelector(createCollectionSelectorForHook(tmdbId)) as MovieCollection;
|
} = useSelector(createCollectionSelectorForHook(tmdbId)) ||
|
||||||
|
({} as MovieCollection);
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
|
@ -29,6 +31,10 @@ function MovieCollectionLabel({ tmdbId }: MovieCollectionLabelProps) {
|
||||||
[id, dispatch]
|
[id, dispatch]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
|
return translate('Unknown');
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<MonitorToggleButton
|
<MonitorToggleButton
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue