[vlc-devel] [PATCH] input: event: don't set non-existing list variable

Francois Cartegnie fcvlcdev at free.fr
Tue Oct 18 15:19:58 CEST 2016


This reverts commit 7ddd2f341f6bd54282061fa44d5c96d2dc560256.
---
 src/input/event.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/input/event.c b/src/input/event.c
index 456c4d7..bed1d9d 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -266,29 +266,30 @@ static const char *GetEsVarName( int i_cat )
         return "video-es";
     case AUDIO_ES:
         return "audio-es";
-    case NAV_ES:
-        return "nav-es";
-    default:
-        assert( i_cat == SPU_ES );
+    case SPU_ES:
         return "spu-es";
+    default:
+        return NULL;
     }
 }
 void input_SendEventEsAdd( input_thread_t *p_input, int i_cat, int i_id, const char *psz_text )
 {
-    if( i_cat != UNKNOWN_ES )
-        VarListAdd( p_input, GetEsVarName( i_cat ), INPUT_EVENT_ES,
-                    i_id, psz_text );
+    const char *psz_varname = GetEsVarName( i_cat );
+    if( psz_varname )
+        VarListAdd( p_input, psz_varname, INPUT_EVENT_ES, i_id, psz_text );
 }
 void input_SendEventEsDel( input_thread_t *p_input, int i_cat, int i_id )
 {
-    if( i_cat != UNKNOWN_ES )
-        VarListDel( p_input, GetEsVarName( i_cat ), INPUT_EVENT_ES, i_id );
+    const char *psz_varname = GetEsVarName( i_cat );
+    if( psz_varname )
+        VarListDel( p_input, psz_varname, INPUT_EVENT_ES, i_id );
 }
 /* i_id == -1 will unselect */
 void input_SendEventEsSelect( input_thread_t *p_input, int i_cat, int i_id )
 {
-    if( i_cat != UNKNOWN_ES )
-        VarListSelect( p_input, GetEsVarName( i_cat ), INPUT_EVENT_ES, i_id );
+    const char *psz_varname = GetEsVarName( i_cat );
+    if( psz_varname )
+        VarListSelect( p_input, psz_varname, INPUT_EVENT_ES, i_id );
 }
 
 void input_SendEventTeletextAdd( input_thread_t *p_input,
-- 
2.7.4



More information about the vlc-devel mailing list