Skip to content

Commit

Permalink
fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
shincurry committed Feb 5, 2020
1 parent 2b8705d commit 9b87e06
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions DUWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,22 @@ - (BOOL) performDragOperation: (id < NSDraggingInfo >) sender

if ([[pboard types] containsObject: NSPasteboardTypeFileURL])
{
NSArray *files = [pboard propertyListForType: NSPasteboardTypeFileURL];
[controller startConversion: [files objectAtIndex: 0]];
/**
Note: tmp fix
ENV: Xcode 11.3.1 (11C504) Catalina 10.15.3 (19D76)
Don't know why [pboard propertyListForType: NSPasteboardTypeFileURL] returns a string directly instead of an array.
*/
NSObject *data = [pboard propertyListForType: NSPasteboardTypeFileURL];
if ([data isKindOfClass: [NSArray class]]) {
NSArray * files = (NSArray *)data;
[controller startConversion: [files objectAtIndex: 0]];
} else if ([data isKindOfClass: [NSString class]]) {
NSString * filePath = (NSString *)data;
NSURL * fileUrl = [NSURL URLWithString: filePath];
[controller startConversion: fileUrl.path];
}

successful = NO;
}

Expand Down

0 comments on commit 9b87e06

Please sign in to comment.