diff --git a/video/out/vo_sixel.c b/video/out/vo_sixel.c index cce6a3da9d..5a5564edc1 100644 --- a/video/out/vo_sixel.c +++ b/video/out/vo_sixel.c @@ -162,7 +162,10 @@ static void dealloc_dithers_and_buffer(struct vo* vo) { struct priv* priv = vo->priv; - talloc_free(priv->buffer); + if (priv->buffer) { + talloc_free(priv->buffer); + priv->buffer = NULL; + } if (priv->dither) { sixel_dither_unref(priv->dither); @@ -296,6 +299,10 @@ static void flip_page(struct vo *vo) { struct priv* priv = vo->priv; + // Make sure that image and dither are valid before drawing + if (priv->buffer == NULL || priv->dither == NULL) + return; + // Go to the offset row and column, then display the image printf(ESC_GOTOXY, priv->top, priv->left); sixel_encode(priv->buffer, priv->width, priv->height,