Avoid exception when creating ChunkIndex with length = 0.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150908893
This commit is contained in:
sammon 2017-03-22 12:01:06 -07:00 committed by Oliver Woodman
parent 8f636991ad
commit e0a00502a7

View File

@ -61,7 +61,11 @@ public final class ChunkIndex implements SeekMap {
this.durationsUs = durationsUs; this.durationsUs = durationsUs;
this.timesUs = timesUs; this.timesUs = timesUs;
length = sizes.length; length = sizes.length;
durationUs = durationsUs[length - 1] + timesUs[length - 1]; if (length > 0) {
durationUs = durationsUs[length - 1] + timesUs[length - 1];
} else {
durationUs = 0;
}
} }
/** /**