From 2051ac785d92dfcf2e7f7246771d102e5ee4fb8f Mon Sep 17 00:00:00 2001 From: akemidx Date: Wed, 8 Nov 2023 13:44:46 -0500 Subject: [PATCH] adding in error logging and code comments --- app/Helpers/Helper.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 0fcee31575..3c5a0e9f11 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -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; } }