diff options
author | Neil <nyamatongwe@gmail.com> | 2014-12-20 13:30:45 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-12-20 13:30:45 +1100 |
commit | 65c581df8051692502612bb45aad5add08c38cf8 (patch) | |
tree | 0b22df7b8d92aecd82b98084c9d736b76996a17b | |
parent | 1b76b38686f609d6a874a348dc81b9675d479b82 (diff) | |
download | scintilla-mirror-65c581df8051692502612bb45aad5add08c38cf8.tar.gz |
Don't use bad value after failed call.
-rw-r--r-- | win32/ScintillaWin.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 35c106d5b..5198b0f21 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -485,10 +485,12 @@ void ScintillaWin::EnsureRenderTarget(HDC hdc) { ID2D1DCRenderTarget *pDCRT = NULL; HRESULT hr = pD2DFactory->CreateDCRenderTarget(&drtp, &pDCRT); - if (FAILED(hr)) { + if (SUCCEEDED(hr)) { + pRenderTarget = pDCRT; + } else { Platform::DebugPrintf("Failed CreateDCRenderTarget 0x%x\n", hr); + pRenderTarget = NULL; } - pRenderTarget = pDCRT; } else { D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp; @@ -499,10 +501,12 @@ void ScintillaWin::EnsureRenderTarget(HDC hdc) { ID2D1HwndRenderTarget *pHwndRenderTarget = NULL; HRESULT hr = pD2DFactory->CreateHwndRenderTarget(drtp, dhrtp, &pHwndRenderTarget); - if (FAILED(hr)) { + if (SUCCEEDED(hr)) { + pRenderTarget = pHwndRenderTarget; + } else { Platform::DebugPrintf("Failed CreateHwndRenderTarget 0x%x\n", hr); + pRenderTarget = NULL; } - pRenderTarget = pHwndRenderTarget; } #else pD2DFactory->CreateHwndRenderTarget( |