1
0
mirror of synced 2024-11-25 00:00:27 +01:00

fix: Crash when pressing delete twice when data processor nodes are selected

This commit is contained in:
WerWolv 2023-09-04 19:58:55 +02:00
parent fc91c8e4b0
commit 7685a22c5f

View File

@ -988,9 +988,10 @@ namespace hex::plugin::builtin {
{
const int selectedLinkCount = ImNodes::NumSelectedLinks();
if (selectedLinkCount > 0 && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete))) {
static std::vector<int> selectedLinks;
std::vector<int> selectedLinks;
selectedLinks.resize(static_cast<size_t>(selectedLinkCount));
ImNodes::GetSelectedLinks(selectedLinks.data());
ImNodes::ClearLinkSelection();
for (const int id : selectedLinks) {
eraseLink(workspace, id);
@ -1002,9 +1003,10 @@ namespace hex::plugin::builtin {
{
const int selectedNodeCount = ImNodes::NumSelectedNodes();
if (selectedNodeCount > 0 && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete))) {
static std::vector<int> selectedNodes;
std::vector<int> selectedNodes;
selectedNodes.resize(static_cast<size_t>(selectedNodeCount));
ImNodes::GetSelectedNodes(selectedNodes.data());
ImNodes::ClearNodeSelection();
this->eraseNodes(workspace, selectedNodes);
}