Fix crash on empty files() statement

This commit is contained in:
NGnius (Graham) 2022-01-06 19:53:10 -05:00
parent 5fe58cda10
commit 73aae27148

View file

@ -125,6 +125,7 @@ impl MpsFunctionFactory<FilesStatement> for FilesFunctionFactory {
let mut root_path = None; let mut root_path = None;
let mut pattern = None; let mut pattern = None;
let mut recursive = None; let mut recursive = None;
if tokens.len() != 0 {
if tokens[0].is_literal() { if tokens[0].is_literal() {
// folder is specified without keyword // folder is specified without keyword
root_path = Some(assert_token( root_path = Some(assert_token(
@ -139,7 +140,6 @@ impl MpsFunctionFactory<FilesStatement> for FilesFunctionFactory {
assert_token_raw(MpsToken::Comma, tokens)?; assert_token_raw(MpsToken::Comma, tokens)?;
} }
} }
if tokens.len() != 0 {
// parse keyword function parameters // parse keyword function parameters
let ingest = |tokens2: &mut VecDeque<MpsToken>| { let ingest = |tokens2: &mut VecDeque<MpsToken>| {
if tokens2.len() < 3 { if tokens2.len() < 3 {