Developer forum

Forum » Templates » Error in getInitials() from user name

Error in getInitials() from user name

Tomas Gomez
Reply

Hi,

We detected a small bug in the getInitials() functions, in the GetInitials and UsersLists templates.

It happens when the user has a final space in his name, i.e. his name is not trimmed. This causes the last split to be empty, triggering an excetion. We are unsure if the final space may happen for all users of only for users imported with integration.

The fix is adding a condition to check that the final split is not empty:

    if (names[names.Length - 1].Length > 0) {
        userInitials += names[names.Length - 1].Substring(0, 1);
    }
 
Regards,
‚ÄčTomas

Replies

 

You must be logged in to post in the forum