File tree Expand file tree Collapse file tree 1 file changed +21
-9
lines changed
Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -293,15 +293,27 @@ impl<'a> Tui<'a> {
293293 bar_content,
294294 false ,
295295 ) ) ;
296- mem_bars. push ( (
297- format ! ( "{unit_name} Swap" ) ,
298- mem. used_swap as f64 / mem. total_swap as f64 * 100.0 ,
299- format_memory ( mem. total_swap , unit) ,
300- 0.0 ,
301- mem. used_swap as f64 / mem. total_swap as f64 ,
302- bar_content,
303- false ,
304- ) ) ;
296+ if mem. total_swap > 0 {
297+ mem_bars. push ( (
298+ format ! ( "{unit_name} Swap" ) ,
299+ mem. used_swap as f64 / mem. total_swap as f64 * 100.0 ,
300+ format_memory ( mem. total_swap , unit) ,
301+ 0.0 ,
302+ mem. used_swap as f64 / mem. total_swap as f64 ,
303+ bar_content,
304+ false ,
305+ ) ) ;
306+ } else {
307+ mem_bars. push ( (
308+ format ! ( "{unit_name} Swap" ) ,
309+ 0.0 ,
310+ 0.0 ,
311+ 0.0 ,
312+ 0.0 ,
313+ bar_content,
314+ false ,
315+ ) ) ;
316+ }
305317 render_bars ( mem_bars, & mut * buf, i) ;
306318 }
307319 }
You can’t perform that action at this time.
0 commit comments