summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJos Dehaes <jos.dehaes@gmail.com>2021-10-03 22:42:01 +0200
committeraristocratos <gnmjpl@gmail.com>2021-10-06 12:45:30 +0200
commiteaf2bb56a503fd2bf3787bfd90b5bc8640b7d628 (patch)
tree0bfdbd06c84f9e8c895411dafbd8b4bc8a1b90d0
parentf66b6f712c361fafbe6d0cfd8f8c0838dc1bb4d2 (diff)
don't crash on deque::back()
-rw-r--r--src/btop_draw.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/btop_draw.cpp b/src/btop_draw.cpp
index d290832..2f3eabc 100644
--- a/src/btop_draw.cpp
+++ b/src/btop_draw.cpp
@@ -815,7 +815,7 @@ namespace Mem {
if (title.empty()) title = capitalize(name);
const string humanized = floating_humanizer(mem.stats.at(name));
const string graphics = (use_graphs ? mem_graphs.at(name)(mem.percent.at(name), redraw or data_same) : mem_meters.at(name)(mem.percent.at(name).back()));
- if (mem_size > 2) {
+ if (mem_size > 2 && mem.percent.at(name).size() > 0) {
out += Mv::to(y+1+cy, x+1+cx) + divider + ljust(title, 4, false, false, not big_mem) + ljust(":", (big_mem ? 1 : 6))
+ Mv::to(y+1+cy, x+cx + mem_width - 2 - humanized.size()) + trans(humanized)
+ Mv::to(y+2+cy, x+cx + (graph_height >= 2 ? 0 : 1)) + graphics + up + rjust(to_string(mem.percent.at(name).back()) + "%", 4);