Skip to content

Commit

Permalink
Merge ddnet#6822
Browse files Browse the repository at this point in the history
6822: Fix editor crashes with quad point and other popup menus r=def- a=Robyt3

Closes ddnet#6817.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <[email protected]>
  • Loading branch information
bors[bot] and Robyt3 authored Jul 8, 2023
2 parents 33209cd + fa65e19 commit 43324d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/game/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6577,12 +6577,9 @@ void CEditor::RenderMousePointer()

void CEditor::Reset(bool CreateDefault)
{
UI()->ClosePopupMenus();
m_Map.Clean();

//delete undo file
char aBuffer[1024];
m_pStorage->GetCompletePath(IStorage::TYPE_SAVE, "editor/", aBuffer, sizeof(aBuffer));

mem_zero(m_apSavedBrushes, sizeof m_apSavedBrushes);

// create default layers
Expand Down
2 changes: 2 additions & 0 deletions src/game/editor/popups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,8 @@ CUI::EPopupMenuFunctionResult CEditor::PopupPoint(void *pContext, CUIRect View,
{
CEditor *pEditor = static_cast<CEditor *>(pContext);
std::vector<CQuad *> vpQuads = pEditor->GetSelectedQuads();
if(!in_range<int>(pEditor->m_SelectedQuadIndex, 0, vpQuads.size() - 1))
return CUI::POPUP_CLOSE_CURRENT;
CQuad *pCurrentQuad = vpQuads[pEditor->m_SelectedQuadIndex];

enum
Expand Down

0 comments on commit 43324d4

Please sign in to comment.