Summary: | Amarok crashes on startup when no config files are present [@ Playlist::Actions::restoreDefaultPlaylist] | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Philipp Schmidt <kde-bugs> |
Component: | Playlist | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | nhn, teo, thierry |
Priority: | VHI | ||
Version: | 2.4-GIT | ||
Target Milestone: | 2.4.0 | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 2.4 | |
Sentry Crash Report: |
Description
Philipp Schmidt
2011-01-06 15:08:38 UTC
I can confirm this bug occurring when there are no /config/amarok* files AND no /apps/amarok directory installed. backtrace: http://pastebin.com/zwygLNfQ and --debug mentions: amarok: [ERROR__] "Could not load local playlist file /home/thierry/.kde/share/apps/amarok/current.xspf!" This is probably due to Amatrok expecting an existing current.xspf file, this file is normally in $HOME/.kde/apps/amarok/ . Very weird bug IMHO. commit c3846167e23b17c6ea12b77a840982e41559e773 branch master Author: Mark Kretschmann <kretschmann@kde.org> Date: Fri Jan 7 11:05:26 2011 +0100 Fix crash on first startup, with clean config. This was caused by dereferencing a 0-pointer. We should do more testing for common cases like clean config, which are uncommon for us devs. BUG: 262307 diff --git a/src/playlist/PlaylistActions.cpp b/src/playlist/PlaylistActions.cpp index 6abb90b..ee40bed 100644 --- a/src/playlist/PlaylistActions.cpp +++ b/src/playlist/PlaylistActions.cpp @@ -464,9 +464,11 @@ Playlist::Actions::restoreDefaultPlaylist() // non-collection Tracks will not be loaded correctly. The::playlistManager(); - Playlists::PlaylistFilePtr playlist = - Playlists::loadPlaylistFile( Amarok::defaultPlaylistPath() ); - playlist->triggerTrackLoad(); //playlist track loading is on demand. + Playlists::PlaylistFilePtr playlist = Playlists::loadPlaylistFile( Amarok::defaultPlaylistPath() ); + + if( playlist ) // This pointer will be 0 on first startup + playlist->triggerTrackLoad(); // playlist track loading is on demand + if( playlist && playlist->tracks().count() > 0 ) { Meta::TrackList tracks = playlist->tracks(); @@ -504,6 +506,7 @@ Playlist::Actions::restoreDefaultPlaylist() if( lastPlayingRow >= 0 ) Playlist::ModelStack::instance()->bottom()->setActiveRow( lastPlayingRow ); } + //Check if we should load the first run jingle, since there is no saved playlist to load else if( AmarokConfig::playFirstRunJingle() ) { |