From 5a1064ef1d73f18c475bfeb4596c2084c5df59b9 Mon Sep 17 00:00:00 2001 From: Erik Goverde Date: Tue, 3 Feb 2026 16:41:17 +0100 Subject: [PATCH] Fix substring extraction in iOS and MacCatalyst After activating an entry in iOS with VoiceOver enabled, a crash occurs when entering a value. Text is initially selected and then gets deselected quickly - the crash is caused by the substring logic getting out-of-bound. --- maui/src/NumericEntry/SfNumericEntry.Methods.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maui/src/NumericEntry/SfNumericEntry.Methods.cs b/maui/src/NumericEntry/SfNumericEntry.Methods.cs index a99784bb..910cba14 100644 --- a/maui/src/NumericEntry/SfNumericEntry.Methods.cs +++ b/maui/src/NumericEntry/SfNumericEntry.Methods.cs @@ -1904,7 +1904,7 @@ string GetSelectedText(int caretPosition) #elif ANDROID return _previousText != null ? _previousText.Substring(caretPosition, _selectionLength) : string.Empty; #elif MACCATALYST || IOS - return _textBox != null && _previousText != null ? _previousText.Substring(caretPosition, _textBox.SelectionLength) : string.Empty; + return _textBox != null && _previousText != null && _textBox.SelectionLength + caretPosition <= _previousText.Length ? _previousText.Substring(caretPosition, _textBox.SelectionLength) : string.Empty; #else return string.Empty; #endif