diff options
author | Erin Power <xampprocky@gmail.com> | 2020-06-22 17:27:20 +0200 |
---|---|---|
committer | Erin Power <xampprocky@gmail.com> | 2020-06-22 17:27:20 +0200 |
commit | 189fe14167472477aa879c04cce392f304d73fe8 (patch) | |
tree | 0fb739b3d59a1f22bf4a3b51740da09cf5f58918 | |
parent | 47c5ea6dfde4163fb24e5553fb12310bee884558 (diff) |
Release 12.0.3v12.0.3tokei@12.0.3
tokei@12.0.3
Generated by cargo-workspaces
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/language/syntax.rs | 7 |
3 files changed, 8 insertions, 3 deletions
@@ -1134,7 +1134,7 @@ checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" [[package]] name = "tokei" -version = "12.0.2" +version = "12.0.3" dependencies = [ "aho-corasick", "clap", @@ -11,7 +11,7 @@ license = "MIT/Apache-2.0" name = "tokei" readme = "README.md" repository = "https://github.com/XAMPPRocky/tokei.git" -version = "12.0.2" +version = "12.0.3" [features] all = ["cbor", "yaml"] diff --git a/src/language/syntax.rs b/src/language/syntax.rs index 6cb4cb6..db43b32 100644 --- a/src/language/syntax.rs +++ b/src/language/syntax.rs @@ -461,8 +461,13 @@ impl SyntaxCounter { LanguageType::from_mime(&String::from_utf8_lossy(m.as_bytes().trim())) }) .unwrap_or(LanguageType::JavaScript); + let script_contents = &lines[start_of_code..end_of_code]; + if script_contents.trim().is_empty() { + return None + } + let stats = language.parse_from_slice( - &lines[start_of_code..end_of_code].trim_first_and_last_line_of_whitespace(), + script_contents.trim_first_and_last_line_of_whitespace(), config, ); Some(FileContext::new( |