[PATCH] comdlg32: Fix error precedence in IFileDialog2_SetFileTypes
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> --- Discovered while debugging ShareX. --- dlls/comdlg32/itemdlg.c | 6 +++--- dlls/comdlg32/tests/itemdlg.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index 1ae20ca782..f17c2f926d 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -2402,12 +2402,12 @@ static HRESULT WINAPI IFileDialog2_fnSetFileTypes(IFileDialog2 *iface, UINT cFil UINT i; TRACE("%p (%d, %p)\n", This, cFileTypes, rgFilterSpec); - if(This->filterspecs) - return E_UNEXPECTED; - if(!rgFilterSpec) return E_INVALIDARG; + if(This->filterspecs) + return E_UNEXPECTED; + if(!cFileTypes) return S_OK; diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c index 6ee0d5fc3d..c38457a0a1 100644 --- a/dlls/comdlg32/tests/itemdlg.c +++ b/dlls/comdlg32/tests/itemdlg.c @@ -675,6 +675,8 @@ static void test_basics(void) ok(hr == S_OK, "got 0x%08x.\n", hr); hr = IFileOpenDialog_SetFileTypes(pfod, 0, filterspec); ok(hr == E_UNEXPECTED, "got 0x%08x.\n", hr); + hr = IFileOpenDialog_SetFileTypes(pfod, 0, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr); hr = IFileOpenDialog_SetFileTypeIndex(pfod, 0); ok(hr == S_OK, "got 0x%08x.\n", hr); hr = IFileOpenDialog_GetFileTypeIndex(pfod, &filetype); -- 2.28.0
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=78460 Your paranoid android. === w10pro64 (32 bit report) === comdlg32: itemdlg: Timeout === w10pro64_2scr (32 bit report) === comdlg32: itemdlg: Timeout === w10pro64_ar (32 bit report) === comdlg32: itemdlg: Timeout === w10pro64_he (32 bit report) === comdlg32: itemdlg: Timeout === w10pro64_ja (32 bit report) === comdlg32: itemdlg: Timeout === w10pro64_zh_CN (32 bit report) === comdlg32: itemdlg: Timeout === w10pro64 (64 bit report) === comdlg32: itemdlg: Timeout === w10pro64_2scr (64 bit report) === comdlg32: itemdlg: Timeout === w10pro64_ar (64 bit report) === comdlg32: itemdlg: Timeout === w10pro64_he (64 bit report) === comdlg32: itemdlg: Timeout === w10pro64_ja (64 bit report) === comdlg32: itemdlg: Timeout === w10pro64_zh_CN (64 bit report) === comdlg32: itemdlg: Timeout
participants (2)
-
Alex Henrie -
Marvin