fixed more rage errors if no image array crunchyroll

This commit is contained in:
stratumadev 2025-11-15 20:14:30 +01:00
parent f90676c81e
commit 928b2bc95d

View file

@ -719,7 +719,7 @@ export default class Crunchy implements ServiceClass {
value: toSend value: toSend
.map((a) => { .map((a) => {
return a.items.map((a): SearchResponseItem => { return a.items.map((a): SearchResponseItem => {
const images = (a.images.poster_tall ?? [[{ source: '/notFound.png' }]])[0]; const images = (a.images?.poster_tall ?? [[{ source: '/notFound.png' }]])[0];
return { return {
id: a.id, id: a.id,
image: images[Math.floor(images.length / 2)].source, image: images[Math.floor(images.length / 2)].source,
@ -3145,7 +3145,7 @@ export default class Crunchy implements ServiceClass {
return { return {
data: sortedEpisodes, data: sortedEpisodes,
list: Object.entries(sortedEpisodes).map(([key, value]) => { list: Object.entries(sortedEpisodes).map(([key, value]) => {
const images = (value.items[0].images.thumbnail ?? [[{ source: '/notFound.png' }]])[0]; const images = (value.items[0].images?.thumbnail ?? [[{ source: '/notFound.png' }]])[0];
const seconds = Math.floor(value.items[0].duration_ms / 1000); const seconds = Math.floor(value.items[0].duration_ms / 1000);
let epNum; let epNum;
if (data?.absolute) { if (data?.absolute) {
@ -3244,7 +3244,7 @@ export default class Crunchy implements ServiceClass {
} }
// set data // set data
const images = (item.images.thumbnail ?? [[{ source: '/notFound.png' }]])[0]; const images = (item.images?.thumbnail ?? [[{ source: '/notFound.png' }]])[0];
const epMeta: CrunchyEpMeta = { const epMeta: CrunchyEpMeta = {
data: [ data: [
{ {