Skip to content

Commit

Permalink
Fix crashes when trying to open nth GPU box with only n-1 GPUs in the…
Browse files Browse the repository at this point in the history
… system
  • Loading branch information
romner-set committed Jul 19, 2023
1 parent 46c6be0 commit 1f73453
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/btop_input.cpp
Expand Up @@ -272,9 +272,9 @@ namespace Input {
else if (is_in(key, "5", "6", "7", "8", "9", "0")) {
atomic_wait(Runner::active);
Config::current_preset = -1;
auto key_i = std::stoi(key);
if (std::cmp_greater(key_i-4, Gpu::gpu_names.size())) return;
Config::toggle_box(std::string("gpu") + (char)((key_i == 0 ? 10 : (key_i-5)) + '0'));
auto key_i = key == "0" ? 10 : std::stoi(key);
if (std::cmp_greater(key_i-3, Gpu::gpu_names.size())) return;
Config::toggle_box(std::string("gpu") + (char)(key_i-5 + '0'));
Draw::calcSizes();
Runner::run("all", false, true);
return;
Expand Down

0 comments on commit 1f73453

Please sign in to comment.