mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
adding in error logging and code comments
This commit is contained in:
parent
9cc89911f7
commit
2051ac785d
|
@ -349,13 +349,18 @@ class Helper
|
|||
$total_colors = count($colors);
|
||||
|
||||
if ($index >= $total_colors) {
|
||||
|
||||
\Log::error('Status label count is '.$index.' and exceeds the allowed count of 256.');
|
||||
//patch fix for array key overflow (color count starts at 1, array starts at 0)
|
||||
$index = $index - $total_colors - 1;
|
||||
|
||||
//constraints to keep result in 0-265 range. This should never be needed, but if something happens
|
||||
//to create this many status labels and it DOES happen, this will keep it from failing at least.
|
||||
if($index < 0) {
|
||||
$index = 0;
|
||||
}
|
||||
elseif($index > 255) {
|
||||
$index = 255;
|
||||
elseif($index > 265) {
|
||||
$index = 265;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue