From e336a96998710c94685d42435acccff15dc8cd4f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 1 Jul 2020 09:06:51 +0200 Subject: FileSetConfig works with empty set of roots Closes #5139 --- crates/vfs/src/file_set.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs index d0ddeafe7..977ba3010 100644 --- a/crates/vfs/src/file_set.rs +++ b/crates/vfs/src/file_set.rs @@ -69,7 +69,7 @@ impl FileSetConfig { Ok(it) => it, 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 } else { self.len() - 1 -- cgit v1.2.3