mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-29 22:51:35 +02: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")) {
|
else if (is_in(key, "5", "6", "7", "8", "9", "0")) {
|
||||||
atomic_wait(Runner::active);
|
atomic_wait(Runner::active);
|
||||||
Config::current_preset = -1;
|
Config::current_preset = -1;
|
||||||
auto key_i = std::stoi(key);
|
auto key_i = key == "0" ? 10 : std::stoi(key);
|
||||||
if (std::cmp_greater(key_i-4, Gpu::gpu_names.size())) return;
|
if (std::cmp_greater(key_i-3, Gpu::gpu_names.size())) return;
|
||||||
Config::toggle_box(std::string("gpu") + (char)((key_i == 0 ? 10 : (key_i-5)) + '0'));
|
Config::toggle_box(std::string("gpu") + (char)(key_i-5 + '0'));
|
||||||
Draw::calcSizes();
|
Draw::calcSizes();
|
||||||
Runner::run("all", false, true);
|
Runner::run("all", false, true);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user