Skip to content

Commit

Permalink
xrGame/ui/UICellItem: don't crash if condition progress bar doesn't e…
Browse files Browse the repository at this point in the history
…xist
  • Loading branch information
Xottab-DUTY committed May 14, 2019
1 parent 013cde8 commit d605f3c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/xrGame/ui/UICellItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Weapon.h"
#include "CustomOutfit.h"
#include "ActorHelmet.h"
#include "UIHelper.h"

CUICellItem* CUICellItem::m_mouse_selected_item = NULL;

Expand Down Expand Up @@ -68,11 +69,14 @@ void CUICellItem::init()
m_upgrade_pos = m_upgrade->GetWndPos();
m_upgrade->Show(false);

m_pConditionState = new CUIProgressBar();
m_pConditionState->SetAutoDelete(true);
AttachChild(m_pConditionState);
CUIXmlInit::InitProgressBar(uiXml, "condition_progess_bar", 0, m_pConditionState);
m_pConditionState->Show(true);
// Try progress first and then progess
m_pConditionState = UIHelper::CreateProgressBar(uiXml, "condition_progress_bar", this, false);

if (!m_pConditionState)
m_pConditionState = UIHelper::CreateProgressBar(uiXml, "condition_progess_bar", this, false);

if (m_pConditionState)
m_pConditionState->Show(true);
}

void CUICellItem::Draw()
Expand Down Expand Up @@ -202,6 +206,9 @@ void CUICellItem::SetOwnerList(CUIDragDropListEx* p)

void CUICellItem::UpdateConditionProgressBar()
{
if (!m_pConditionState)
return;

if (m_pParentList && m_pParentList->GetConditionProgBarVisibility())
{
PIItem itm = static_cast<PIItem>(m_pData);
Expand Down

0 comments on commit d605f3c

Please sign in to comment.