diff --git a/Resources/Private/JavaScript/core/src/hooks/useDeleteAsset.ts b/Resources/Private/JavaScript/core/src/hooks/useDeleteAsset.ts index 84ceb832e..262d743e5 100644 --- a/Resources/Private/JavaScript/core/src/hooks/useDeleteAsset.ts +++ b/Resources/Private/JavaScript/core/src/hooks/useDeleteAsset.ts @@ -44,7 +44,7 @@ export default function useDeleteAsset() { assetRemoved({ assetId, assetSourceId }); // Unselect currently selected asset if it was just deleted - setSelectedAsset((prev) => (prev.assetId === assetId ? null : prev)); + setSelectedAsset((prev) => (prev?.assetId === assetId ? null : prev)); }); return { deleteAsset, data, error };