From f4de84b5faba5c0c879d5595b1b43ad14311ab05 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 13 Nov 2017 05:13:34 -0800 Subject: [PATCH] Fix invalid asset ID handling in CGuiModel and CAuiImagePane --- Runtime/GuiSys/CAuiImagePane.cpp | 4 ++-- Runtime/GuiSys/CGuiModel.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Runtime/GuiSys/CAuiImagePane.cpp b/Runtime/GuiSys/CAuiImagePane.cpp index ef332e0e3..78e1d1a7d 100644 --- a/Runtime/GuiSys/CAuiImagePane.cpp +++ b/Runtime/GuiSys/CAuiImagePane.cpp @@ -187,7 +187,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const bool CAuiImagePane::GetIsFinishedLoadingWidgetSpecific() const { - return xb8_tex0Tok.IsLoaded(); + return !xb8_tex0Tok || xb8_tex0Tok.IsLoaded(); } void CAuiImagePane::SetTextureID0(CAssetId tex, CSimplePool* sp) @@ -195,7 +195,7 @@ void CAuiImagePane::SetTextureID0(CAssetId tex, CSimplePool* sp) xc8_tex0 = tex; if (!sp) return; - if (xc8_tex0 != -1) + if (xc8_tex0.IsValid()) xb8_tex0Tok = sp->GetObj({FOURCC('TXTR'), xc8_tex0}); else xb8_tex0Tok = TLockedToken(); diff --git a/Runtime/GuiSys/CGuiModel.cpp b/Runtime/GuiSys/CGuiModel.cpp index 3da8118aa..e2d337e5a 100644 --- a/Runtime/GuiSys/CGuiModel.cpp +++ b/Runtime/GuiSys/CGuiModel.cpp @@ -11,7 +11,7 @@ namespace urde CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag) : CGuiWidget(parms), x108_modelId(modelId), x10c_lightMask(lightMask) { - if (!flag || modelId == 0xffffffff || + if (!flag || !modelId.IsValid() || parms.x0_frame->GetGuiSys().GetUsageMode() == CGuiSys::EUsageMode::Two) return;