Bug 1452041 - nsClipboard::HasDataMatchingFlavors(): return immediately when there's no clipboard content, r?jhorak
MozReview-Commit-ID: CTz0tRr3p57
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -391,16 +391,18 @@ nsClipboard::HasDataMatchingFlavors(cons
{
if (!aFlavorList || !_retval)
return NS_ERROR_NULL_POINTER;
*_retval = false;
int targetNums;
GdkAtom* targets = mContext->GetTargets(aWhichClipboard, &targetNums);
+ if (!targets)
+ return NS_OK;
// Walk through the provided types and try to match it to a
// provided type.
for (uint32_t i = 0; i < aLength && !*_retval; i++) {
// We special case text/unicode here.
if (!strcmp(aFlavorList[i], kUnicodeMime) &&
gtk_targets_include_text(targets, targetNums)) {
*_retval = true;