Skip to content

Commit fa51bad

Browse files
committed
[GEN][ZH] Fix uninitialized back-buffer surface
1 parent ccf4584 commit fa51bad

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,10 +2403,11 @@ SurfaceClass * DX8Wrapper::_Get_DX8_Back_Buffer(unsigned int num)
24032403
{
24042404
DX8_THREAD_ASSERT();
24052405

2406-
IDirect3DSurface8 * bb;
2406+
IDirect3DSurface8 * bb=NULL;
24072407
SurfaceClass *surf=NULL;
2408-
DX8CALL(GetBackBuffer(num,D3DBACKBUFFER_TYPE_MONO,&bb));
2409-
if (bb)
2408+
HRESULT hres=S_FALSE;
2409+
DX8CALL_HRES(GetBackBuffer(num,D3DBACKBUFFER_TYPE_MONO,&bb), hres);
2410+
if (hres==D3D_OK && bb)
24102411
{
24112412
surf=NEW_REF(SurfaceClass,(bb));
24122413
bb->Release();

GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,10 +3161,11 @@ SurfaceClass * DX8Wrapper::_Get_DX8_Back_Buffer(unsigned int num)
31613161
{
31623162
DX8_THREAD_ASSERT();
31633163

3164-
IDirect3DSurface8 * bb;
3164+
IDirect3DSurface8 * bb=NULL;
31653165
SurfaceClass *surf=NULL;
3166-
DX8CALL(GetBackBuffer(num,D3DBACKBUFFER_TYPE_MONO,&bb));
3167-
if (bb)
3166+
HRESULT hres=S_FALSE;
3167+
DX8CALL_HRES(GetBackBuffer(num,D3DBACKBUFFER_TYPE_MONO,&bb), hres);
3168+
if (hres==D3D_OK && bb)
31683169
{
31693170
surf=NEW_REF(SurfaceClass,(bb));
31703171
bb->Release();

0 commit comments

Comments
 (0)