This repository was archived by the owner on Apr 29, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Runtime/Plugins/platform/ios Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -425,6 +425,10 @@ - (NSUInteger)incrementOffsetPosition:(NSUInteger)position {
425
425
426
426
- (UITextPosition*)positionFromPosition : (UITextPosition*)position offset : (NSInteger )offset {
427
427
NSUInteger offsetPosition = ((UIWidgetsTextPosition*)position).index ;
428
+ NSInteger newLocation = (NSInteger )offsetPosition + offset;
429
+ if (newLocation < 0 || newLocation > (NSInteger )self.text .length ) {
430
+ return nil ;
431
+ }
428
432
if (offset >= 0 ) {
429
433
for (NSInteger i = 0 ; i < offset && offsetPosition < self.text .length ; ++i)
430
434
offsetPosition = [self incrementOffsetPosition: offsetPosition];
@@ -552,8 +556,8 @@ - (void)updateEditingState {
552
556
NSUInteger selectionBase = ((UIWidgetsTextPosition*)_selectedTextRange.start ).index ;
553
557
NSUInteger selectionExtent = ((UIWidgetsTextPosition*)_selectedTextRange.end ).index ;
554
558
555
- NSUInteger composingBase = 0 ;
556
- NSUInteger composingExtent = 0 ;
559
+ NSUInteger composingBase = - 1 ;
560
+ NSUInteger composingExtent = - 1 ;
557
561
if (self.markedTextRange != nil ) {
558
562
composingBase = ((UIWidgetsTextPosition*)self.markedTextRange .start ).index ;
559
563
composingExtent = ((UIWidgetsTextPosition*)self.markedTextRange .end ).index ;
You can’t perform that action at this time.
0 commit comments