5155: FileSetConfig works with empty set of roots r=matklad a=matklad

Closes #5139



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-07-01 07:08:26 +00:00 committed by GitHub
commit 5749c42b71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,7 +69,7 @@ impl FileSetConfig {
Ok(it) => it, Ok(it) => it,
Err(it) => it.saturating_sub(1), Err(it) => it.saturating_sub(1),
}; };
if path.starts_with(&self.roots[idx].0) { if !self.roots.is_empty() && path.starts_with(&self.roots[idx].0) {
self.roots[idx].1 self.roots[idx].1
} else { } else {
self.len() - 1 self.len() - 1