Skip to content

Commit

Permalink
Fix NPE in load on iOS/macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Dec 3, 2024
1 parent 3d3815f commit 28462e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions just_audio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.43

* Fix NPE in load on iOS/macOS.

## 0.9.42

* Fix dealloc crash on iOS/macOS (@cristian1980).
Expand Down
4 changes: 2 additions & 2 deletions just_audio/darwin/Classes/AudioPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ - (void)load:(NSDictionary *)source initialPosition:(CMTime)initialPosition init
[_indexedAudioSources[i] attach:_player initialPos:(i == _index ? initialPosition : kCMTimeInvalid)];
}

if (_indexedAudioSources.count == 0 || !_player.currentItem ||
_player.currentItem.status == AVPlayerItemStatusReadyToPlay) {
if (_loadResult && (_indexedAudioSources.count == 0 || !_player.currentItem ||
_player.currentItem.status == AVPlayerItemStatusReadyToPlay)) {
_processingState = ready;
_loadResult(@{@"duration": @([self getDurationMicroseconds])});
_loadResult = nil;
Expand Down
2 changes: 1 addition & 1 deletion just_audio/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: just_audio
description: A feature-rich audio player for Flutter. Loop, clip and concatenate any sound from any source (asset/file/URL/stream) in a variety of audio formats with gapless playback.
version: 0.9.42
version: 0.9.43
repository: https://github.com/ryanheise/just_audio/tree/minor/just_audio
issue_tracker: https://github.com/ryanheise/just_audio/issues
topics:
Expand Down

0 comments on commit 28462e1

Please sign in to comment.