Skip to content

Commit

Permalink
Null check playlist's first track in mpris api
Browse files Browse the repository at this point in the history
  • Loading branch information
nukeop committed Jun 7, 2024
1 parent 7f6195e commit a7563af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/main/src/services/@linux/system-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const loopStatusMapper: Record<string, LoopStatus> = {
* @see {@link https://github.com/altdesktop/playerctl}
*/

@systemMediaController()
@systemMediaController()
class LinuxMediaService extends MprisService implements NuclearApi {
tracks: MprisMeta[];

Expand Down Expand Up @@ -87,7 +87,7 @@ class LinuxMediaService extends MprisService implements NuclearApi {
return {
Id: this.objectPath(`playlist/${index}`),
Name: playlist.name,
Icon: playlist.tracks[0].thumbnail || ''
Icon: playlist.tracks?.[0]?.thumbnail || ''
};
}

Expand Down Expand Up @@ -118,7 +118,7 @@ class LinuxMediaService extends MprisService implements NuclearApi {
this.loopStatus = this.loopStatus === MprisService.LOOP_STATUS_PLAYLIST
? MprisService.LOOP_STATUS_NONE
: MprisService.LOOP_STATUS_PLAYLIST;

this.window.send(IpcEvents.SETTINGS, { loopAfterQueueEnd: this.loopStatus === MprisService.LOOP_STATUS_PLAYLIST });
}

Expand Down Expand Up @@ -231,7 +231,7 @@ class LinuxMediaService extends MprisService implements NuclearApi {
this.playbackStatus = statusMapper[status.playbackStatus];
this.volume = status.volume / 100;
this.shuffle = status.shuffleQueue;
this.loopStatus =loopStatusMapper[status.loopAfterQueueEnd.toString()];
this.loopStatus = loopStatusMapper[status.loopAfterQueueEnd.toString()];

const meta: ControllerMeta[] = Reflect.getMetadata(SYSTEM_MEDIA_EVENT_KEY, LinuxMediaService.prototype);

Expand Down

0 comments on commit a7563af

Please sign in to comment.