fix(cli): prevent crash when parsing stdin
When we are parsing stdin via a pipe or heredoc, the source count is 0 (unsigned) so the XML output crashes while trying to subtract from it.
This commit is contained in:
parent
1dc4804b6e
commit
0cf6e7c507
1 changed files with 11 additions and 1 deletions
|
|
@ -230,13 +230,23 @@ impl ParseSummary {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug, Default)]
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct ParseStats {
|
||||
pub parse_summaries: Vec<ParseSummary>,
|
||||
pub cumulative_stats: Stats,
|
||||
pub source_count: usize,
|
||||
}
|
||||
|
||||
impl Default for ParseStats {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
parse_summaries: Vec::new(),
|
||||
cumulative_stats: Stats::default(),
|
||||
source_count: 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, ValueEnum, Debug, Copy, Clone, Default, Eq, PartialEq)]
|
||||
pub enum ParseDebugType {
|
||||
#[default]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue