diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index 0e9d276426..bec06f5700 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -483,8 +483,10 @@ gst_vaapi_decoder_finalize (GObject * object) decoder->frames = NULL; } - gst_vaapi_context_unref (decoder->context); - decoder->context = NULL; + if (decoder->context) { + gst_vaapi_context_unref (decoder->context); + decoder->context = NULL; + } decoder->va_context = VA_INVALID_ID; gst_vaapi_display_replace (&decoder->display, NULL);