Fixes related to file input and File API

This commit is contained in:
Zhen Zhang 2016-05-02 10:39:54 +08:00
parent e65009f317
commit e0f3cdafe1
3 changed files with 15 additions and 6 deletions

View file

@ -40,7 +40,11 @@ impl FileListMethods for FileList {
// https://w3c.github.io/FileAPI/#dfn-item
fn Item(&self, index: u32) -> Option<Root<File>> {
Some(Root::from_ref(&*(self.list[index as usize])))
if (index as usize) < self.list.len() {
Some(Root::from_ref(&*(self.list[index as usize])))
} else {
None
}
}
// check-tidy: no specs after this line