From 65d86a44740a612dfccb04bc49b0a2a7974df358 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 7 Jan 2019 12:27:33 +0100
Subject: [PATCH] bluray: don't use a region if it's not allocated

(cherry picked from commit b315699d76399989811f87e2cceb674553bf6db8)
---
 modules/access/bluray.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 337b4d88f820..09d8d1075beb 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -1755,13 +1755,15 @@ static void blurayDrawOverlay(demux_t *p_demux, const BD_OVERLAY* const ov)
         video_format_Setup(&fmt, VLC_CODEC_YUVP, ov->w, ov->h, ov->w, ov->h, 1, 1);
 
         p_reg = subpicture_region_New(&fmt);
-        p_reg->i_x = ov->x;
-        p_reg->i_y = ov->y;
-        /* Append it to our list. */
-        if (p_last != NULL)
-            p_last->p_next = p_reg;
-        else /* If we don't have a last region, then our list empty */
-            p_sys->p_overlays[ov->plane]->p_regions = p_reg;
+        if (p_reg) {
+            p_reg->i_x = ov->x;
+            p_reg->i_y = ov->y;
+            /* Append it to our list. */
+            if (p_last != NULL)
+                p_last->p_next = p_reg;
+            else /* If we don't have a last region, then our list empty */
+                p_sys->p_overlays[ov->plane]->p_regions = p_reg;
+        }
     }
 
     /* Now we can update the region, regardless it's an update or an insert */
-- 
GitLab