check whether info entity returned by mpd is NULL or not

This commit is contained in:
unK
2008-10-19 18:48:57 +02:00
parent ae0a665504
commit f7e56300cf
2 changed files with 10 additions and 6 deletions

View File

@@ -376,11 +376,16 @@ Song MPDConnection::GetCurrentSong() const
mpd_sendCurrentSongCommand(itsConnection); mpd_sendCurrentSongCommand(itsConnection);
mpd_InfoEntity *item = NULL; mpd_InfoEntity *item = NULL;
item = mpd_getNextInfoEntity(itsConnection); item = mpd_getNextInfoEntity(itsConnection);
Song result = item->info.song; if (item)
item->info.song = 0; {
mpd_freeInfoEntity(item); Song result = item->info.song;
mpd_finishCommand(itsConnection); item->info.song = 0;
return result; mpd_freeInfoEntity(item);
mpd_finishCommand(itsConnection);
return result;
}
else
return Song();
} }
else else
return Song(); return Song();

View File

@@ -103,7 +103,6 @@ time_t timer;
int now_playing = -1; int now_playing = -1;
int browsed_dir_scroll_begin = 0; int browsed_dir_scroll_begin = 0;
int stats_scroll_begin = 0;
int lock_statusbar_delay = -1; int lock_statusbar_delay = -1;