Add a nil check to prevent a crash

This commit is contained in:
Adam Gleitman 2022-04-11 16:38:28 -07:00
Родитель 87a8f43014
Коммит 57c8333ddc
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -493,7 +493,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
if (range.location + range.length > backedTextInputView.attributedText.string.length) {
_predictedText = backedTextInputView.attributedText.string;
} else {
} else if (text != nil) { // TODO(macOS GH#774): -[NSString stringByReplacingCharactersInRange:withString:] doesn't like when the replacement string is nil
_predictedText = [backedTextInputView.attributedText.string stringByReplacingCharactersInRange:range withString:text];
}