Mercurial > mplayer.hg
comparison mplayer.c @ 36579:c11abb032606
mplayer: Simplify initial playtree/file code.
Also avoids a theoretical NULL dereference if play_tree_iter_step
does not return an entry.
"Theoretical" since I don't know if or how this case would
be possible to trigger, so it might in fact be dead code.
author | reimar |
---|---|
date | Mon, 20 Jan 2014 22:08:45 +0000 |
parents | dd4ceae6520a |
children | 68794f2fbf1e |
comparison
equal
deleted
inserted
replaced
36578:dd4ceae6520a | 36579:c11abb032606 |
---|---|
2812 } | 2812 } |
2813 #endif | 2813 #endif |
2814 | 2814 |
2815 mpctx->playtree = m_config_parse_mp_command_line(mconfig, argc, argv); | 2815 mpctx->playtree = m_config_parse_mp_command_line(mconfig, argc, argv); |
2816 if (mpctx->playtree == NULL) { | 2816 if (mpctx->playtree == NULL) { |
2817 // parse error | |
2817 opt_exit = 1; | 2818 opt_exit = 1; |
2818 } else { | 2819 } else |
2819 mpctx->playtree = play_tree_cleanup(mpctx->playtree); | 2820 mpctx->playtree = play_tree_cleanup(mpctx->playtree); |
2820 if (mpctx->playtree) { | 2821 |
2821 mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree, mconfig); | 2822 mpctx->playtree_iter = mpctx->playtree ? play_tree_iter_new(mpctx->playtree, mconfig) : NULL; |
2822 if (mpctx->playtree_iter) { | 2823 if (mpctx->playtree_iter && play_tree_iter_step(mpctx->playtree_iter, 0, 0) != PLAY_TREE_ITER_ENTRY) { |
2823 if (play_tree_iter_step(mpctx->playtree_iter, 0, 0) != PLAY_TREE_ITER_ENTRY) { | 2824 play_tree_iter_free(mpctx->playtree_iter); |
2824 play_tree_iter_free(mpctx->playtree_iter); | 2825 mpctx->playtree_iter = NULL; |
2825 mpctx->playtree_iter = NULL; | 2826 } |
2826 } | 2827 |
2827 filename = play_tree_iter_get_file(mpctx->playtree_iter, 1); | 2828 filename = mpctx->playtree_iter ? play_tree_iter_get_file(mpctx->playtree_iter, 1) : NULL; |
2828 } | |
2829 } | |
2830 } | |
2831 | 2829 |
2832 print_version("MPlayer"); | 2830 print_version("MPlayer"); |
2833 #if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_GUI) | 2831 #if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_GUI) |
2834 void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows"); | 2832 void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows"); |
2835 if (runningmplayer && filename && use_gui) { | 2833 if (runningmplayer && filename && use_gui) { |