vlc-thumb: fix error handling

If the thumbnail fails, the returned picture is NULL. It is handled that way in
the snapshot() function. But libvlc_picture_retain() doesn't handle NULL
pictures.
This commit is contained in:
Steve Lhomme 2023-01-25 12:46:16 +01:00
parent 0801b577b2
commit 86e598311e
1 changed files with 2 additions and 1 deletions

View File

@ -116,8 +116,9 @@ static void callback(const libvlc_event_t *ev, void *param)
{
libvlc_picture_t** pic = param;
pthread_mutex_lock(&lock);
libvlc_picture_retain(ev->u.media_thumbnail_generated.p_thumbnail);
*pic = ev->u.media_thumbnail_generated.p_thumbnail;
if (*pic != NULL)
libvlc_picture_retain(*pic);
done = true;
pthread_cond_signal(&wait);
pthread_mutex_unlock(&lock);