Merge pull request #7907 from archimede67/editor-fix-quads-crash

Editor: fix crash when changing layer with UP or DOWN while quad popup is opened
This commit is contained in:
heinrich5991 2024-02-02 21:53:58 +00:00 committed by GitHub
commit 1337e522da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -828,6 +828,8 @@ CUI::EPopupMenuFunctionResult CEditor::PopupQuad(void *pContext, CUIRect View, b
{
CEditor *pEditor = static_cast<CEditor *>(pContext);
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];
std::shared_ptr<CLayerQuads> pLayer = std::static_pointer_cast<CLayerQuads>(pEditor->GetSelectedLayerType(0, LAYERTYPE_QUADS));