This commit is contained in:
Compilenix 2016-04-28 22:27:19 +02:00
parent cbe3074c6b
commit 97a655c856

@ -40,8 +40,12 @@ std::string load_string( bool use_colors, bool use_powerline, short num_averages
double averages[num_averages];
// based on: opensource.apple.com/source/Libc/Libc-262/gen/getloadavg.c
if( num_averages > 0)
if( num_averages <= 0 || num_averages > 3)
{
ss << (char) 0;
return ss.str();
}
if( getloadavg( averages, num_averages ) < 0 )
{
ss << " 0.00 0.00 0.00"; // couldn't get averages.
@ -88,11 +92,6 @@ std::string load_string( bool use_colors, bool use_powerline, short num_averages
}
}
}
}
else
{
ss << (char) 0;
}
return ss.str();
}