Fix NPE in FakeDataSource.close()

If open() fails because of the file isn't available then fakeData is null.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160249214
This commit is contained in:
eguven 2017-06-27 01:45:13 -07:00 committed by Oliver Woodman
parent 410228acb8
commit 444dbeb4c4

View File

@ -199,7 +199,7 @@ public final class FakeDataSource implements DataSource {
Assertions.checkState(opened);
opened = false;
uri = null;
if (currentSegmentIndex < fakeData.segments.size()) {
if (fakeData != null && currentSegmentIndex < fakeData.segments.size()) {
Segment current = fakeData.segments.get(currentSegmentIndex);
if (current.isErrorSegment() && current.exceptionThrown) {
current.exceptionCleared = true;