Skip to content

Commit 915bd64

Browse files
authored
[GEN][ZH] Prevent dereferencing NULL pointer 'tex' in WW3DAssetManager::Get_Texture() (#1089)
1 parent 0ebdeeb commit 915bd64

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,12 @@ TextureClass * WW3DAssetManager::Get_Texture
11451145
{
11461146
tex = NEW_REF (TextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression));
11471147
}
1148+
else
1149+
{
1150+
WWASSERT_PRINT(false, ("Unhandled case"));
1151+
return NULL;
1152+
}
1153+
11481154
TextureHash.Insert(tex->Get_Texture_Name(),tex);
11491155
}
11501156

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,12 @@ TextureClass * WW3DAssetManager::Get_Texture
11221122
{
11231123
tex = NEW_REF (VolumeTextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression, allow_reduction));
11241124
}
1125+
else
1126+
{
1127+
WWASSERT_PRINT(false, ("Unhandled case"));
1128+
return NULL;
1129+
}
1130+
11251131
TextureHash.Insert(tex->Get_Texture_Name(),tex);
11261132
}
11271133

0 commit comments

Comments
 (0)