Skip to content

Commit 3c2dad4

Browse files
authored
Merge pull request #490 from microsoft/user/dwayner/FixThrowIfFailed
Fix THROW_IF_FAILED double evaluation
2 parents ccb8944 + 8b613cb commit 3c2dad4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Tools/WinMLRunner/src/Common.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ using namespace winrt;
6464
#ifndef THROW_IF_FAILED
6565
#define THROW_IF_FAILED(hr) \
6666
{ \
67-
if (FAILED(hr)) \
68-
throw hresult_error(hr); \
67+
HRESULT localHresult = (hr); \
68+
if (FAILED(localHresult)) \
69+
throw hresult_error(localHresult); \
6970
}
7071
#endif
7172
inline std::wstring MakeErrorMsg(HRESULT hr)

0 commit comments

Comments
 (0)