Fix a possible exception if charactersIgnoringModifiers returns a zero length string.

This commit is contained in:
Damiano Galassi committed 2016-02-23 11:15:43 +01:00
1 parent f78185270c
commit db161ee78f
1 file changed
+6 -1
+6 -1
View File
@@ -36,7 +36,12 @@
{
id delegate = [self delegate];
unichar key = [[event charactersIgnoringModifiers] characterAtIndex:0];
unichar key = 0;
NSString *characters = [event charactersIgnoringModifiers];
if (characters.length) {
key = [characters characterAtIndex:0];
}
if ((key == NSEnterCharacter || key == NSCarriageReturnCharacter) &&
_defaultEditingColumn > 0) {
[self editColumn:_defaultEditingColumn row:[self selectedRow] withEvent:nil select:YES];