[vlc-devel] [PATCH] d3d9_adjust: fix reading an unknown variable

Steve Lhomme robux4 at videolabs.io
Mon Jul 3 09:34:43 CEST 2017


we apply standard default/range values
---
 modules/video_output/win32/d3d9_adjust.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/win32/d3d9_adjust.c b/modules/video_output/win32/d3d9_adjust.c
index 58149bfadd..032889ea9c 100644
--- a/modules/video_output/win32/d3d9_adjust.c
+++ b/modules/video_output/win32/d3d9_adjust.c
@@ -178,10 +178,19 @@ static void InitLevel(filter_t *filter, struct filter_level *range, const char *
 {
     int level;
 
-    module_config_t *cfg = config_FindConfig( VLC_OBJECT(filter), p_name);
-    range->min = cfg->min.f;
-    range->max = cfg->max.f;
-    range->default_val = def;
+    module_config_t *cfg = config_FindConfig( VLC_OBJECT(filter), p_name );
+    if (unlikely(cfg == NULL))
+    {
+        range->min         = 0.;
+        range->max         = 2.;
+        range->default_val = 1.;
+    }
+    else
+    {
+        range->min = cfg->min.f;
+        range->max = cfg->max.f;
+        range->default_val = def;
+    }
 
     float val = var_CreateGetFloatCommand( filter, p_name );
 
-- 
2.12.1



More information about the vlc-devel mailing list