mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
fixed index out of bounds checking when getting cpu, gpu or display in PlatformInstance.cpp
This commit is contained in:
parent
ba7ed32135
commit
a6c569dd78
1 changed files with 4 additions and 3 deletions
|
@ -42,7 +42,8 @@ void Instance::enumerateNics() {
|
|||
|
||||
json Instance::getCPU(int index) {
|
||||
assert(index <(int) _cpus.size());
|
||||
if (index >= (int)_cpus.size())
|
||||
|
||||
if (index <= 0 || (int) _cpus.size() <= index)
|
||||
return json();
|
||||
|
||||
return _cpus.at(index);
|
||||
|
@ -51,7 +52,7 @@ json Instance::getCPU(int index) {
|
|||
json Instance::getGPU(int index) {
|
||||
assert(index <(int) _gpus.size());
|
||||
|
||||
if (index >=(int) _gpus.size())
|
||||
if (index <= 0 || (int) _gpus.size() <= index)
|
||||
return json();
|
||||
|
||||
return _gpus.at(index);
|
||||
|
@ -60,7 +61,7 @@ json Instance::getGPU(int index) {
|
|||
json Instance::getDisplay(int index) {
|
||||
assert(index <(int) _displays.size());
|
||||
|
||||
if (index >=(int) _displays.size())
|
||||
if (index <= 0 || (int) _displays.size() <= index)
|
||||
return json();
|
||||
|
||||
return _displays.at(index);
|
||||
|
|
Loading…
Reference in a new issue