Skip to content

Commit 8627643

Browse files
authored
fix FilePathDataSource crash before initialize. (#160)
1 parent dab9ac2 commit 8627643

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)