From a6c2b5d6ec6d205a421e23b767ed9157c8296656 Mon Sep 17 00:00:00 2001 From: Ac_K Date: Tue, 6 Jul 2021 20:55:03 +0200 Subject: [PATCH] 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 . --- Ryujinx/Ui/Windows/ControllerWindow.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Ryujinx/Ui/Windows/ControllerWindow.cs b/Ryujinx/Ui/Windows/ControllerWindow.cs index 655f1afb75..c57a62c70b 100644 --- a/Ryujinx/Ui/Windows/ControllerWindow.cs +++ b/Ryujinx/Ui/Windows/ControllerWindow.cs @@ -231,12 +231,12 @@ namespace Ryujinx.Ui.Windows private static string GetShrinkedGamepadName(string str) { - const string ShrinkChars = ".."; - const int MaxSize = 52; + const string ShrinkChars = "..."; + 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;