提交 ffabe5ac 编写于 作者: C Chinmay Garde 提交者: GitHub

When pasting an item of type kTextPlainFormat from the pasteboard, ensure...

When pasting an item of type kTextPlainFormat from the pasteboard, ensure there actually is a string in the pasteboard. (#3638)
上级 da8ebf40
......@@ -177,8 +177,11 @@ using namespace shell;
- (NSDictionary*)getClipboardData:(NSString*)format {
UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
if (!format || [format isEqualToString:@(kTextPlainFormat)])
return @{ @"text" : pasteboard.string };
if (!format || [format isEqualToString:@(kTextPlainFormat)]) {
NSString* stringInPasteboard = pasteboard.string;
// The pasteboard may contain an item but it may not be a string (an image for instance).
return stringInPasteboard == nil ? nil : @{@"text" : stringInPasteboard};
}
return nil;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册