https://git.reactos.org/?p=reactos.git;a=commitdiff;h=21a168e574f8a64a2c47d5...
commit 21a168e574f8a64a2c47d5392a728ae934314195 Author: Ratin Gao ratin@knsoft.org AuthorDate: Mon Jan 23 01:38:16 2023 +0800 Commit: GitHub noreply@github.com CommitDate: Sun Jan 22 20:38:16 2023 +0300
[ATL] CImage::Load(): Return E_FAIL without ATLASSERT on failure (#4993)
Application won't be interrupted by ATLASSERT when image load failure happens, just like it was done in MS ATL.
CORE-18589 --- sdk/lib/atl/atlimage.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/sdk/lib/atl/atlimage.h b/sdk/lib/atl/atlimage.h index f124c9a1483..f84d8cb5919 100644 --- a/sdk/lib/atl/atlimage.h +++ b/sdk/lib/atl/atlimage.h @@ -382,8 +382,10 @@ public: // create a GpBitmap object from file using namespace Gdiplus; GpBitmap *pBitmap = NULL; - GetCommon().CreateBitmapFromFile(pszNameW, &pBitmap); - ATLASSERT(pBitmap); + if (GetCommon().CreateBitmapFromFile(pszNameW, &pBitmap) != Ok) + { + return E_FAIL; + }
// TODO & FIXME: get parameters (m_rgbTransColor etc.)
@@ -407,8 +409,10 @@ public: // create GpBitmap from stream using namespace Gdiplus; GpBitmap *pBitmap = NULL; - GetCommon().CreateBitmapFromStream(pStream, &pBitmap); - ATLASSERT(pBitmap); + if (GetCommon().CreateBitmapFromStream(pStream, &pBitmap) != Ok) + { + return E_FAIL; + }
// TODO & FIXME: get parameters (m_rgbTransColor etc.)