Check selected quad index when rendering quad popup (fixes #7904)

This commit is contained in:
Corantin H 2024-02-02 22:14:56 +01:00
parent 863ae5f9b6
commit d988b92b38

View file

@ -828,6 +828,8 @@ CUI::EPopupMenuFunctionResult CEditor::PopupQuad(void *pContext, CUIRect View, b
{ {
CEditor *pEditor = static_cast<CEditor *>(pContext); CEditor *pEditor = static_cast<CEditor *>(pContext);
std::vector<CQuad *> vpQuads = pEditor->GetSelectedQuads(); std::vector<CQuad *> vpQuads = pEditor->GetSelectedQuads();
if(pEditor->m_SelectedQuadIndex < 0 || pEditor->m_SelectedQuadIndex >= (int)vpQuads.size())
return CUI::POPUP_CLOSE_CURRENT;
CQuad *pCurrentQuad = vpQuads[pEditor->m_SelectedQuadIndex]; CQuad *pCurrentQuad = vpQuads[pEditor->m_SelectedQuadIndex];
std::shared_ptr<CLayerQuads> pLayer = std::static_pointer_cast<CLayerQuads>(pEditor->GetSelectedLayerType(0, LAYERTYPE_QUADS)); std::shared_ptr<CLayerQuads> pLayer = std::static_pointer_cast<CLayerQuads>(pEditor->GetSelectedLayerType(0, LAYERTYPE_QUADS));