Mutable CustomizableObject::GetEnumParameterNumValues/Value returns 0/s_EmptyString if ParamIndex is 0

GetEnumParameterNumValues reads as follows:

int32 UCustomizableObject::GetEnumParameterNumValues(const FString& ParamName) const
{
  if (int32 ParamIndex = GetPrivate()->FindParameter(ParamName))
  {
    return GetPrivate()->GetEnumParameterNumValues(ParamIndex);
  }
  else
  {
    return 0;
  }
}

If ParamIndex is 0, it will return 0, despite a 0 param index being valid. It should instead be structured like ContainsEnumParameterValue, which is directly below it in the file:

bool UCustomizableObject::ContainsEnumParameterValue(const FString& ParameterName, const FString Value) const
{
  int32 ParamIndex = GetPrivate()->FindParameter(ParameterName);
  if (ParamIndex == INDEX_NONE)
  {
    return false;
  }

  return GetPrivate()->FindIntParameterValue(ParamIndex, Value) != INDEX_NONE;
}

Implementing a similar == INDEX_NONE check would get this function working as expected when getting enum parameter values for a param at index 0.

Steps to Reproduce

  1. Call the Function GetEnumParameterNumValues or GetEnumParameterValue with the ParamName for a Parameter at ParamIndex 0.
  2. The function will treat 0, a valid index, as invalid (as with INDEX_NONE) and return a default.

Hi, thanks for taking the time to report this. It turns out that we’ve already made the changes that you suggested, they’ll be part of the 5.7 release.