Commit 584e22a4 authored by Felix Paul Kühne's avatar Felix Paul Kühne

creating a player can fail, add missing sanity checks (fixes #229)

parent 63fde66f
......@@ -1380,6 +1380,11 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
}
libvlc_retain([_privateLibrary instance]);
_playerInstance = libvlc_media_player_new([_privateLibrary instance]);
if (_playerInstance == NULL) {
NSAssert(0, "%s: player initialization failed", __PRETTY_FUNCTION__);
libvlc_release([_privateLibrary instance]);
return nil;
}
[self registerObservers];
......
......@@ -206,6 +206,10 @@ static void display(void *opaque, void *picture)
NSAssert(!_mp, @"We are already fetching a thumbnail");
_mp = libvlc_media_player_new(self.libVLCinstance);
if (_mp = NULL) {
NSAssert(0, "%s: creating the player instance failed", __PRETTY_FUNCTION__);
[self endThumbnailing];
}
libvlc_media_add_option([_media libVLCMediaDescriptor], "no-audio");
libvlc_media_add_option([_media libVLCMediaDescriptor], "no-spu");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment