mirror of
https://github.com/aristocratos/btop.git
synced 2024-05-15 09:54:33 +12:00
Fix crashes when trying to open nth GPU box with only n-1 GPUs in the system
This commit is contained in:
parent
46c6be0a29
commit
1f73453aec
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue