Skip to content

Commit

Permalink
Fix crash when no nvidia GPU is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
romner-set committed May 14, 2023
1 parent 0e0025a commit 2d27f2f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/btop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ namespace Runner {
if (Global::debug) debug_timer("gpu", draw_begin);

//? Draw box
if (not pause_output) output += Gpu::draw(gpu, conf.force_redraw, conf.no_update);
if (not pause_output and Gpu::Nvml::initialized) output += Gpu::draw(gpu, conf.force_redraw, conf.no_update);

if (Global::debug) debug_timer("gpu", draw_done);
}
Expand Down
2 changes: 1 addition & 1 deletion src/btop_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ namespace Draw {
Cpu::redraw = Gpu::redraw = Mem::redraw = Net::redraw = Proc::redraw = true;

Cpu::shown = s_contains(boxes, "cpu");
Gpu::shown = s_contains(boxes, "gpu");
Gpu::shown = s_contains(boxes, "gpu") and Gpu::Nvml::initialized;
Mem::shown = s_contains(boxes, "mem");
Net::shown = s_contains(boxes, "net");
Proc::shown = s_contains(boxes, "proc");
Expand Down
2 changes: 1 addition & 1 deletion src/btop_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace Term {
bool mem = boxes.find("mem") != string::npos;
bool net = boxes.find("net") != string::npos;
bool proc = boxes.find("proc") != string::npos;
bool gpu = boxes.find("gpu") != string::npos;
bool gpu = boxes.find("gpu") != string::npos and Gpu::Nvml::initialized;
int width = 0;
if (mem) width = Mem::min_width;
else if (net) width = Mem::min_width;
Expand Down

0 comments on commit 2d27f2f

Please sign in to comment.