Skip to content

Commit 1b7efce

Browse files
authored
fix(UBSAN): ensure [RCTUITextField validAttributesForMarkedText] Is non null (#2515)
## Summary: Internally, we build with [UndefinedBehaviorSanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html), which caught an instance of a method returning nil while marked as non null. Apple documentation says that method should return an empty array as a fallback, so let's do that. ## Test Plan: Tested internally.
1 parent e1ded73 commit 1b7efce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ - (BOOL)hasMarkedText
161161

162162
- (NSArray<NSAttributedStringKey> *)validAttributesForMarkedText
163163
{
164-
return ((NSTextView *)self.currentEditor).validAttributesForMarkedText;
164+
return ((NSTextView *)self.currentEditor).validAttributesForMarkedText ?: @[];
165165
}
166166

167167
#endif // macOS]

0 commit comments

Comments
 (0)