ASSERT when right clicking on SVG Image generating Share menu - can break Web Inspector
[WebKit-https.git] / Source / WebKit2 / UIProcess / mac / WebContextMenuProxyMac.mm
index f47c3f56d90462a4a47e4a947bbb7768502f6a65..05ac812a040ef2651f10284c38ee139f1ad59393 100644 (file)
@@ -341,6 +341,8 @@ ContextMenuItem WebContextMenuProxyMac::shareMenuItem()
         image = adoptNS([[NSImage alloc] initWithData:[NSData dataWithBytes:(unsigned char*)hitTestData.imageSharedMemory->data() length:hitTestData.imageSize]]);
 
     ContextMenuItem item = ContextMenuItem::shareMenuItem(absoluteLinkURL, downloadableMediaURL, image.get(), m_context.selectedText());
+    if (item.isNull())
+        return item;
 
     NSMenuItem *nsItem = item.platformDescription();
 
@@ -397,7 +399,9 @@ void WebContextMenuProxyMac::showContextMenu()
         }
 
 #if ENABLE(SERVICE_CONTROLS)
-        proposedAPIItems.append(WebContextMenuItem::create(shareMenuItem()));
+        ContextMenuItem shareItem = shareMenuItem();
+        if (!shareItem.isNull())
+            proposedAPIItems.append(WebContextMenuItem::create(shareItem));
 #endif
     }