fix: scrobble may be undefined

This commit is contained in:
FoxxMD 2026-09-25 09:44:48 -04:00
parent 270fb2414e
commit ae416866f4
2 changed files with 3 additions and 3 deletions

View file

@ -110,7 +110,7 @@ export type GroupedFixedPlays = TupleMap<DeviceId,PlayUserId,FixedSizeList<Progr
export interface ScrobbledPlayObject {
play: PlayObject
scrobble: PlayObjectMinimal
scrobble?: PlayObjectMinimal
}

View file

@ -758,7 +758,7 @@ export default abstract class AbstractScrobbleClient extends AbstractComponent i
// if no existing transform then we can run cheap db match
const cheapExisting = await this.playRepo.checkExisting(playObj, {states: ['scrobbled'], notId: playObjPre.id});
if(cheapExisting !== undefined) {
const s: ScrobbledPlayObject = {play: cheapExisting.play, scrobble: cheapExisting.play.scrobble?.mergedScrobble!};
const s: ScrobbledPlayObject = {play: cheapExisting.play, scrobble: cheapExisting.play.scrobble?.mergedScrobble};
return [s, [s]];
}
}
@ -782,7 +782,7 @@ export default abstract class AbstractScrobbleClient extends AbstractComponent i
return [undefined, []];
}
const s: ScrobbledPlayObject = {play: matchPlayDate, scrobble: matchPlayDate.scrobble?.mergedScrobble!};
const s: ScrobbledPlayObject = {play: matchPlayDate, scrobble: matchPlayDate.scrobble?.mergedScrobble};
return [s, [s]];
}