From a942c6c56de5599ebc8d7b788d91acd12b9288e2 Mon Sep 17 00:00:00 2001
From: Gildas Bazin <gbazin@videolan.org>
Date: Mon, 26 Apr 2004 13:06:17 +0000
Subject: [PATCH] * modules/video_filter/deinterlace.c: avoid segfault when
 deinterlacing filter can't be loaded.

---
 modules/video_filter/deinterlace.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/video_filter/deinterlace.c b/modules/video_filter/deinterlace.c
index 311665f3cbfb..1198510a4e81 100644
--- a/modules/video_filter/deinterlace.c
+++ b/modules/video_filter/deinterlace.c
@@ -165,6 +165,7 @@ static int Create( vlc_object_t *p_this )
     p_vout->p_sys->i_mode = DEINTERLACE_DISCARD;
     p_vout->p_sys->b_double_rate = 0;
     p_vout->p_sys->last_date = 0;
+    p_vout->p_sys->p_vout = 0;
     vlc_mutex_init( p_vout, &p_vout->p_sys->filter_lock );
 
 #if defined(CAN_COMPILE_C_ALTIVEC)
@@ -383,10 +384,12 @@ static void Destroy( vlc_object_t *p_this )
 {
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
 
-    DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
-
-    vlc_object_detach( p_vout->p_sys->p_vout );
-    vout_Destroy( p_vout->p_sys->p_vout );
+    if( p_vout->p_sys->p_vout )
+    {
+        DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+        vlc_object_detach( p_vout->p_sys->p_vout );
+        vout_Destroy( p_vout->p_sys->p_vout );
+    }
 
     DEL_PARENT_CALLBACKS( SendEventsToChild );
 
-- 
GitLab