Added an extra check in OptionListComponent to avoid potential crashes

This commit is contained in:
Leon Styhre 2024-08-24 12:03:56 +02:00
parent ae779a42e6
commit f7cc0f6ace

View file

@ -343,7 +343,9 @@ private:
mText.setText(ss.str());
mText.setSize(0, mText.getSize().y);
setSize(mText.getTextCache()->metrics.size.x + mRightArrow.getSize().x +
setSize(
(mText.getTextCache() == nullptr ? 0.0f : mText.getTextCache()->metrics.size.x) +
mRightArrow.getSize().x +
Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 0.68f,
mText.getSize().y);
if (mParent)
@ -363,8 +365,10 @@ private:
}
mText.setSize(0.0f, mText.getSize().y);
setSize(mText.getTextCache()->metrics.size.x + mLeftArrow.getSize().x +
mRightArrow.getSize().x +
setSize((mText.getTextCache() == nullptr ?
0.0f :
mText.getTextCache()->metrics.size.x) +
mLeftArrow.getSize().x + mRightArrow.getSize().x +
Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 0.68f,
mText.getSize().y);
if (mParent)