Require a non-empty drag image to prevent crash

This commit is contained in:
Kevin Sawicki 2017-01-26 10:38:13 -08:00
parent 8ce1930f0d
commit e683f28e32
2 changed files with 15 additions and 5 deletions

View file

@ -1327,9 +1327,17 @@ void WebContents::StartDrag(const mate::Dictionary& item,
// Error checking.
if (icon.IsEmpty()) {
args->ThrowError("Must specify 'icon' option");
return;
}
#if defined(OS_MACOSX)
// NSWindow.dragImage requires a non-empty NSImage
if (icon->image().IsEmpty()) {
args->ThrowError("Must specify non-empty 'icon' option");
return;
}
#endif
// Start dragging.
if (!files.empty()) {