Add null check in FLETextInputPlugin (flutter/engine#8538)

Adds a guard on `_activeClientID` in `insertNewline:`. The conditional
around the `insertText:replacementRange:` call already catches this, but
we then unconditionally pack `_activeClientID` into an `NSArray`, which
disallows nil.
This commit is contained in:
Chris Bracken 2019-04-12 21:10:23 -07:00 committed by GitHub
parent 5d2a294ba2
commit e7bd1767be

View File

@ -242,11 +242,13 @@ static NSString* const kMultilineInputType = @"TextInputType.multiline";
}
- (void)insertNewline:(id)sender {
if ([self.activeModel.inputType isEqualToString:kMultilineInputType]) {
[self insertText:@"\n" replacementRange:self.activeModel.selectedRange];
if (self.activeModel != nil) {
if ([self.activeModel.inputType isEqualToString:kMultilineInputType]) {
[self insertText:@"\n" replacementRange:self.activeModel.selectedRange];
}
[_channel invokeMethod:kPerformAction
arguments:@[ _activeClientID, self.activeModel.inputAction ]];
}
[_channel invokeMethod:kPerformAction
arguments:@[ _activeClientID, self.activeModel.inputAction ]];
}
- (void)setMarkedText:(id)string