Skip to content

Commit

Permalink
Fix NoiseTool crash when deleting multiple links/nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed Apr 11, 2021
1 parent c2ffc0c commit ddb7ee5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CMakeList.txt : CMake project for FastNoise
cmake_minimum_required(VERSION 3.7.1)

project(FastNoise2 VERSION 0.8.0)
project(FastNoise2 VERSION 0.8.1)
set(CMAKE_CXX_STANDARD 17)

option(FASTNOISE2_NOISETOOL "Build Noise Tool" ON)
Expand Down
11 changes: 7 additions & 4 deletions NoiseTool/FastNoiseNodeEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,11 @@ void FastNoiseNodeEditor::CheckLinks()
void FastNoiseNodeEditor::UpdateSelected()
{
std::vector<int> linksToDelete;
int selectedLinkCount = imnodes::NumSelectedLinks();

if( int selectedCount = imnodes::NumSelectedLinks() && ImGui::IsKeyPressed( ImGui::GetKeyIndex( ImGuiKey_Delete ), false ) )
if( selectedLinkCount && ImGui::IsKeyPressed( ImGui::GetKeyIndex( ImGuiKey_Delete ), false ) )
{
linksToDelete.resize( selectedCount );
linksToDelete.resize( selectedLinkCount );
imnodes::GetSelectedLinks( linksToDelete.data() );
}

Expand Down Expand Up @@ -432,9 +433,11 @@ void FastNoiseNodeEditor::UpdateSelected()
}
}

if( int selectedCount = imnodes::NumSelectedNodes() && ImGui::IsKeyPressed( ImGui::GetKeyIndex( ImGuiKey_Delete ), false ) )
int selectedNodeCount = imnodes::NumSelectedNodes();

if( selectedNodeCount && ImGui::IsKeyPressed( ImGui::GetKeyIndex( ImGuiKey_Delete ), false ) )
{
std::vector<int> selected( selectedCount );
std::vector<int> selected( selectedNodeCount );

imnodes::GetSelectedNodes( selected.data() );

Expand Down

0 comments on commit ddb7ee5

Please sign in to comment.