Skip to content

Commit

Permalink
fix FilePathDataSource crash before initialize. (deepmedia#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
tateisu authored Mar 12, 2022
1 parent dab9ac2 commit 8627643
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,16 @@ public void releaseTrack(@NonNull TrackType type) {

@Override
public boolean isInitialized() {
return mSource.isInitialized();
return mSource != null && mSource.isInitialized();
}

@Override
public void initialize() {
// Make it easier for subclasses to put their logic in initialize safely.
if (!mSource.isInitialized()) {
if (!isInitialized()) {
if (mSource == null) {
throw new NullPointerException("DataSourceWrapper's source is not set!");
}
mSource.initialize();
}
}
Expand Down

0 comments on commit 8627643

Please sign in to comment.