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 @@ -319,15 +319,27 @@ impl<'a> Tui<'a> {
319
319
bar_content,
320
320
false ,
321
321
) ) ;
322
- mem_bars. push ( (
323
- format ! ( "{unit_name} Swap" ) ,
324
- mem. used_swap as f64 / mem. total_swap as f64 * 100.0 ,
325
- format_memory ( mem. total_swap , unit) ,
326
- 0.0 ,
327
- mem. used_swap as f64 / mem. total_swap as f64 ,
328
- bar_content,
329
- false ,
330
- ) ) ;
322
+ if mem. total_swap > 0 {
323
+ mem_bars. push ( (
324
+ format ! ( "{unit_name} Swap" ) ,
325
+ mem. used_swap as f64 / mem. total_swap as f64 * 100.0 ,
326
+ format_memory ( mem. total_swap , unit) ,
327
+ 0.0 ,
328
+ mem. used_swap as f64 / mem. total_swap as f64 ,
329
+ bar_content,
330
+ false ,
331
+ ) ) ;
332
+ } else {
333
+ mem_bars. push ( (
334
+ format ! ( "{unit_name} Swap" ) ,
335
+ 0.0 ,
336
+ 0.0 ,
337
+ 0.0 ,
338
+ 0.0 ,
339
+ bar_content,
340
+ false ,
341
+ ) ) ;
342
+ }
331
343
render_bars ( mem_bars, & mut * buf, i) ;
332
344
}
333
345
}
You can’t perform that action at this time.
0 commit comments