diff options
Diffstat (limited to 'components/script/dom/filelist.rs')
-rw-r--r-- | components/script/dom/filelist.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/components/script/dom/filelist.rs b/components/script/dom/filelist.rs index e60258fa330..ef49e88da6d 100644 --- a/components/script/dom/filelist.rs +++ b/components/script/dom/filelist.rs @@ -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 |