From c85e29f00587b8b6aabd79fc3f4d2fd8d0800419 Mon Sep 17 00:00:00 2001 From: Inrixia Date: Wed, 6 Nov 2024 13:43:02 +1300 Subject: [PATCH] fix #96 RealMAX infinite loop --- plugins/_lib/MaxTrack.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/_lib/MaxTrack.ts b/plugins/_lib/MaxTrack.ts index 7c550fa7..6e37cf2e 100644 --- a/plugins/_lib/MaxTrack.ts +++ b/plugins/_lib/MaxTrack.ts @@ -8,13 +8,14 @@ export type TrackFilter = (trackItem: Resource) => boolean; export class MaxTrack { public static getMaxTrack = AsyncCachable(async (itemId: ItemId): Promise => { for await (const trackItem of this.getTracksFromItemId(itemId, this.hasHiRes)) { - return trackItem; + if (trackItem.id !== itemId) return trackItem; } return false; }); public static getLatestMaxTrack = AsyncCachable(async (itemId: ItemId): Promise => { let currentTrackItem: TrackItem | false = false; for await (const trackItem of this.getTracksFromItemId(itemId)) { + if (trackItem.id === itemId) continue; if (currentTrackItem === undefined) { currentTrackItem = trackItem; continue;