Commit 5cc7fedd authored by Felix Paul Kühne's avatar Felix Paul Kühne

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

(cherry picked from commit 584e22a4)
parent ec6a99c3
...@@ -1383,6 +1383,11 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self) ...@@ -1383,6 +1383,11 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
} }
libvlc_retain([_privateLibrary instance]); libvlc_retain([_privateLibrary instance]);
_playerInstance = libvlc_media_player_new([_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]; [self registerObservers];
......
...@@ -206,6 +206,10 @@ static void display(void *opaque, void *picture) ...@@ -206,6 +206,10 @@ static void display(void *opaque, void *picture)
NSAssert(!_mp, @"We are already fetching a thumbnail"); NSAssert(!_mp, @"We are already fetching a thumbnail");
_mp = libvlc_media_player_new(self.libVLCinstance); _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-audio");
libvlc_media_add_option([_media libVLCMediaDescriptor], "no-spu"); 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