-
-
Notifications
You must be signed in to change notification settings - Fork 186
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
If you press "Return" at the end of the buffer in iOS 26.1 beta (23B82) you get a crash triggered by Apple's WritingTools not expecting a nil return from text(in:):
https://gist.github.com/migueldeicaza/82b3d5833b20286b80caf6a3ff2fb7ce
The code there is not coping well with a nil return, so my solution was to return an empty string if the request was out of range, rather than returning nil
diff --git a/Sources/Runestone/TextView/Core/StringView.swift b/Sources/Runestone/TextView/Core/StringView.swift
index d00356e..15ee2cb 100644
--- a/Sources/Runestone/TextView/Core/StringView.swift
+++ b/Sources/Runestone/TextView/Core/StringView.swift
@@ -51,7 +51,7 @@ final class StringView {
if range.location >= 0 && range.upperBound <= internalString.length && range.length > 0 {
return internalString.substring(with: range)
} else {
- return nil
+ return ""
}
}
What are the steps to reproduce?
Press return at the end of the text buffer in the Example.
What is the expected behavior?
Not crash
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working