diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d28b712a..2cfb348ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,3 +25,4 @@ - [Fix] Fix a potential crash when cell nodes that need layout are deleted during the same runloop. [Adlai Holler](https://github.com/Adlai-Holler) [#279](https://github.com/TextureGroup/Texture/pull/279) - [Batch fetching] Add ASBatchFetchingDelegate that takes scroll velocity and remaining time into account [Huy Nguyen](https://github.com/nguyenhuy) [#281](https://github.com/TextureGroup/Texture/pull/281) - [Fix] Fix a major regression in our image node contents caching. [Adlai Holler](https://github.com/Adlai-Holler) [#287](https://github.com/TextureGroup/Texture/pull/287) +- [Fix] Fixed a bug where ASVideoNodeDelegate error reporting callback would crash an app because of not responding to selector. [Sergey Petrachkov](https://github.com/Petrachkov) [#291](https://github.com/TextureGroup/Texture/issues/291) diff --git a/Source/ASVideoNode.mm b/Source/ASVideoNode.mm index ce61ab3b2..84486a831 100644 --- a/Source/ASVideoNode.mm +++ b/Source/ASVideoNode.mm @@ -58,6 +58,7 @@ @interface ASVideoNode () unsigned int delegateVideoNodeDidSetCurrentItem:1; unsigned int delegateVideoNodeDidStallAtTimeInterval:1; unsigned int delegateVideoNodeDidRecoverFromStall:1; + unsigned int delegateVideoNodeDidFailToLoadValueForKey:1; } _delegateFlags; BOOL _shouldBePlaying; @@ -153,7 +154,9 @@ - (void)prepareToPlayAsset:(AVAsset *)asset withKeys:(NSArray *)requ AVKeyValueStatus keyStatus = [asset statusOfValueForKey:key error:&error]; if (keyStatus == AVKeyValueStatusFailed) { NSLog(@"Asset loading failed with error: %@", error); - [self.delegate videoNode:self didFailToLoadValueForKey:key asset:asset error:error]; + if (_delegateFlags.delegateVideoNodeDidFailToLoadValueForKey) { + [self.delegate videoNode:self didFailToLoadValueForKey:key asset:asset error:error]; + } } } @@ -604,6 +607,7 @@ - (void)setDelegate:(id)delegate _delegateFlags.delegateVideoNodeDidSetCurrentItem = [delegate respondsToSelector:@selector(videoNode:didSetCurrentItem:)]; _delegateFlags.delegateVideoNodeDidStallAtTimeInterval = [delegate respondsToSelector:@selector(videoNode:didStallAtTimeInterval:)]; _delegateFlags.delegateVideoNodeDidRecoverFromStall = [delegate respondsToSelector:@selector(videoNodeDidRecoverFromStall:)]; + _delegateFlags.delegateVideoNodeDidFailToLoadValueForKey = [delegate respondsToSelector:@selector(videoNode:didFailToLoadValueForKey:asset:error:)]; } }