N°3791 - Fix crash when displaying object with a null state value

This commit is contained in:
Molkobain
2021-09-28 12:51:21 +02:00
parent 57b08b5b24
commit 4c6a7ca30b
3 changed files with 6 additions and 6 deletions

View File

@@ -59,7 +59,7 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
protected $sObjectMode;
/** @var string */
protected $sIconUrl;
/** @var string Code of the current value of the attribute carrying the state for $sClassName */
/** @var string|null Code of the current value of the attribute carrying the state for $sClassName */
protected $sStatusCode;
/** @var string Label of the current value of the attribute carrying the state for $sClassName */
protected $sStatusLabel;

View File

@@ -19,12 +19,12 @@ namespace Combodo\iTop\Application\UI\Helper;
class UIHelper
{
/**
* @param string $sStateCode Code of the state value
* @param string|null $sStateCode Code of the state value, can be null if allowed by the attribute definition
* @param bool $bAllowFallbackIfNoMatch If set to true, a fallback semantic color code will be returned in case of no matching mappping. Otherwise it will return null to indicate there was no match.
*
* @return string|null A semantic status color name (eg. success, pending, failure, neutral, ...) depending on the value's code. Usefull to try to find a semantic match when a class has no style defined on its state attribute.
*/
public static function GetColorNameFromStatusCode(string $sStateCode, bool $bAllowFallbackIfNoMatch = true): ?string
public static function GetColorNameFromStatusCode(?string $sStateCode, bool $bAllowFallbackIfNoMatch = true): ?string
{
$sStatusColor = null;