Skip to content

Commit

Permalink
temparary fix for inline values causing a sub underflow, causing an i…
Browse files Browse the repository at this point in the history
…nfinite loop/memory leak
  • Loading branch information
LivacoNew committed Jul 1, 2024
1 parent 87df1dd commit 360c704
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{cmp::max, env, fmt::{Debug, Display}, process::exit, time::Instant};
use std::{cmp::{max, min}, env, fmt::{Debug, Display}, process::exit, time::Instant};

use battery::BatteryInfo;
use cpu::CPUInfo;
Expand Down Expand Up @@ -159,7 +159,7 @@ trait Module {
str.push_str(&title.to_string());
// Inline value stuff
if config.inline_values {
for _ in 0..(max_title_len - (title.chars().count() as u64)) {
for _ in 0..(max_title_len - min(title.chars().count() as u64, max_title_len)) {
str.push_str(" ");
}
}
Expand Down

0 comments on commit 360c704

Please sign in to comment.