[PATCH] ole32: check for interface NULL which happens with e.g. Abiword

Dmitry Timoshkov dmitry at codeweavers.com
Thu Sep 16 10:06:07 CDT 2010


Marcus Meissner <marcus at jet.franken.de> wrote:

> +  unk = NULL;
>    hr = IDropTarget_QueryInterface(pDropTarget, &IID_IUnknown, (void**)&unk);
>    if(FAILED(hr))
>    {
>        IStream_Release(stream);
>        return hr;
>    }
> +  if (!unk) {
> +      WARN("hr was %d, but unk is NULL.\n", hr);
> +      IStream_Release(stream);
> +      return E_NOINTERFACE;
> +  }
>    hr = CoMarshalInterface(stream, &IID_IDropTarget, unk, MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
>    IUnknown_Release(unk);

Huw suggested a more simple solution which doesn't lead to duplicated code:

+  unk = NULL;
   hr = IDropTarget_QueryInterface(pDropTarget, &IID_IUnknown, (void**)&unk);
+  if (!unk) hr = E_NOINTERFACE;
   if(FAILED(hr))

-- 
Dmitry.



More information about the wine-devel mailing list