ui: Fixes GetShrinkedGamepadName (#2444)
There is a wrong condition in `GetShrinkedGamepadName` which throw an oob if the controller name is equal to the checked value. It's now fixed and shoud closes #2442 .
This commit is contained in:
parent
242e51c7f5
commit
a6c2b5d6ec
1 changed files with 4 additions and 4 deletions
|
@ -231,12 +231,12 @@ namespace Ryujinx.Ui.Windows
|
||||||
|
|
||||||
private static string GetShrinkedGamepadName(string str)
|
private static string GetShrinkedGamepadName(string str)
|
||||||
{
|
{
|
||||||
const string ShrinkChars = "..";
|
const string ShrinkChars = "...";
|
||||||
const int MaxSize = 52;
|
const int MaxSize = 50;
|
||||||
|
|
||||||
if (str.Length > MaxSize - ShrinkChars.Length)
|
if (str.Length > MaxSize)
|
||||||
{
|
{
|
||||||
return str.Substring(0, MaxSize) + ShrinkChars;
|
return str.Substring(0, MaxSize - ShrinkChars.Length) + ShrinkChars;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
|
Loading…
Reference in a new issue