From 15a7456aba14b33c7fdc3ac3945adfe3749c50e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 14 Dec 2011 17:24:41 +0100 Subject: [PATCH] Fixing bug with empty string --- file/lib/util/ChatUtil.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/file/lib/util/ChatUtil.class.php b/file/lib/util/ChatUtil.class.php index d45f58f..b7ac5e5 100644 --- a/file/lib/util/ChatUtil.class.php +++ b/file/lib/util/ChatUtil.class.php @@ -31,6 +31,8 @@ class ChatUtil { */ public static function gradient($string, $start, $end) { $string = self::str_split($string); + if (count($string) === 0) return ''; + $r = (int) ((($start >> 16 & 255) - ($end >> 16 & 255)) / (count($string) - 1)); $g = (int) ((($start >> 8 & 255) - ($end >> 8 & 255)) / (count($string) - 1)); $b = (int) ((($start & 255) - ($end & 255)) / (count($string) - 1));