Fix invalid asset ID handling in CGuiModel and CAuiImagePane

This commit is contained in:
Phillip Stephens 2017-11-13 05:13:34 -08:00
parent 550078f7cb
commit f4de84b5fa
2 changed files with 3 additions and 3 deletions

View File

@ -187,7 +187,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const
bool CAuiImagePane::GetIsFinishedLoadingWidgetSpecific() const bool CAuiImagePane::GetIsFinishedLoadingWidgetSpecific() const
{ {
return xb8_tex0Tok.IsLoaded(); return !xb8_tex0Tok || xb8_tex0Tok.IsLoaded();
} }
void CAuiImagePane::SetTextureID0(CAssetId tex, CSimplePool* sp) void CAuiImagePane::SetTextureID0(CAssetId tex, CSimplePool* sp)
@ -195,7 +195,7 @@ void CAuiImagePane::SetTextureID0(CAssetId tex, CSimplePool* sp)
xc8_tex0 = tex; xc8_tex0 = tex;
if (!sp) if (!sp)
return; return;
if (xc8_tex0 != -1) if (xc8_tex0.IsValid())
xb8_tex0Tok = sp->GetObj({FOURCC('TXTR'), xc8_tex0}); xb8_tex0Tok = sp->GetObj({FOURCC('TXTR'), xc8_tex0});
else else
xb8_tex0Tok = TLockedToken<CTexture>(); xb8_tex0Tok = TLockedToken<CTexture>();

View File

@ -11,7 +11,7 @@ namespace urde
CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag) CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag)
: CGuiWidget(parms), x108_modelId(modelId), x10c_lightMask(lightMask) : CGuiWidget(parms), x108_modelId(modelId), x10c_lightMask(lightMask)
{ {
if (!flag || modelId == 0xffffffff || if (!flag || !modelId.IsValid() ||
parms.x0_frame->GetGuiSys().GetUsageMode() == CGuiSys::EUsageMode::Two) parms.x0_frame->GetGuiSys().GetUsageMode() == CGuiSys::EUsageMode::Two)
return; return;