Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#12200 closed Bug Report - Crash (fixed)

MythMusic crash after new scan

Reported by: JYA Owned by: paulh
Priority: minor Milestone: 0.28
Component: Plugin - MythMusic Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Just upgraded a machine to use SG for MythMusic

Ran a scan, which contained less files than my local storage

Got a crash:

this patch fixes it:

diff --git a/mythplugins/mythmusic/mythmusic/musicplayer.cpp b/mythplugins/mythmusic/mythmusic/musicplayer.cpp
index fdf777e..824154c 100644
--- a/mythplugins/mythmusic/mythmusic/musicplayer.cpp
+++ b/mythplugins/mythmusic/mythmusic/musicplayer.cpp
@@ -1083,7 +1083,8 @@ void MusicPlayer::restorePosition(void)
     {
         for (int x = 0; x < getCurrentPlaylist()->getTrackCount(); x++)
         {
-            if (getCurrentPlaylist()->getSongAt(x)->ID() == id)
+            if (getCurrentPlaylist()->getSongAt(x) &&
+                getCurrentPlaylist()->getSongAt(x)->ID() == id)
             {
                 m_currentTrack = x;
                 break;

For whatever reasons, getCurrentPlaylist()->getSongAt(x) returned NULL

Change History (3)

comment:1 Changed 10 years ago by JYA

Owner: set to paulh
Status: newassigned

comment:2 Changed 10 years ago by Paul Harrison <pharrison@…>

Resolution: fixed
Status: assignedclosed

In 5447a509c2f19fd8c842d9a3b013a89cc88977be/mythtv:

MythMusic: fix a possible crash after scanning for music

MusicMetadata::getSongAt() can return NULL so guard against that.
Fixes #12200. Thanks to JYA for finding the problem.

comment:3 Changed 10 years ago by paulh

Milestone: unknown0.28
Note: See TracTickets for help on using tickets.