mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-11-27 04:00:34 +00:00
noticed some weird exceptions, which I have no idea how they can happen
This commit is contained in:
parent
960ddb9fe6
commit
1045211985
@ -8,8 +8,11 @@ public static class Utils
|
||||
private const long UnderMB = 1000 * 1024;
|
||||
private const long UnderGB = 1000 * 1024 * 1024;
|
||||
|
||||
public static string Trim(this string str, int maxLength)
|
||||
public static string Trim(this string? str, int maxLength)
|
||||
{
|
||||
if (str is null)
|
||||
return "";
|
||||
|
||||
if (str.Length > maxLength)
|
||||
return str[..(maxLength - 1)] + "…";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user