Skip to content

Commit 1b76fc2

Browse files
jumpersontateisu
andauthored
fix FilePathDataSource crash before initialize. (#1)
Co-authored-by: tateisu <[email protected]>
1 parent e6d71d2 commit 1b76fc2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/src/main/java/com/otaliastudios/transcoder/source/DataSourceWrapper.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,16 @@ public void releaseTrack(@NonNull TrackType type) {
9696

9797
@Override
9898
public boolean isInitialized() {
99-
return mSource.isInitialized();
99+
return mSource != null && mSource.isInitialized();
100100
}
101101

102102
@Override
103103
public void initialize() {
104104
// Make it easier for subclasses to put their logic in initialize safely.
105-
if (!mSource.isInitialized()) {
105+
if (!isInitialized()) {
106+
if (mSource == null) {
107+
throw new NullPointerException("DataSourceWrapper's source is not set!");
108+
}
106109
mSource.initialize();
107110
}
108111
}

0 commit comments

Comments
 (0)