Update models_obj.cpp

This commit is contained in:
Chernoskill 2021-03-06 11:27:23 +01:00 committed by GitHub
parent 27cf152438
commit d1ea33a815
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -636,7 +636,7 @@ void FOBJModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int f
OBJSurface *surf = &surfaces[i];
FGameTexture *userSkin = skin;
if (!userSkin)
if (!userSkin && curSpriteMDLFrame)
{
int ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
@ -671,7 +671,7 @@ void FOBJModel::AddSkins(uint8_t* hitlist)
for (size_t i = 0; i < surfaces.Size(); i++)
{
size_t ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
if (curSpriteMDLFrame && i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
{
// Precache skins manually reassigned by the user.
// On OBJs with lots of skins, such as Doom map OBJs exported from GZDB,