1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-03 05:22:23 +00:00

playtree: fix segfault on empty playlist

Add a sanity check to avoid a segmentation fault in playtree.c on
empty playlists.
This is Debian Bug: http://bugs.debian.org/591525

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31960 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
siretart 2010-08-13 15:58:11 +00:00 committed by Uoti Urpala
parent 920ee4dc53
commit 733dabb37e

View File

@ -218,8 +218,15 @@ void
play_tree_set_child(play_tree_t* pt, play_tree_t* child) {
play_tree_t* iter;
/* Roughly validate input data. Both, pt and child are going to be
* dereferenced, hence assure they're not NULL.
*/
if (!pt || !child) {
mp_msg(MSGT_PLAYTREE, MSGL_ERR, "Internal error, attempt to add an empty child or use empty playlist\n");
return;
}
#ifdef MP_DEBUG
assert(pt != NULL);
assert(pt->entry_type == PLAY_TREE_ENTRY_NODE);
#endif