Skip to content

Commit ddb7ee5

Browse files
committed
Fix NoiseTool crash when deleting multiple links/nodes
1 parent c2ffc0c commit ddb7ee5

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# CMakeList.txt : CMake project for FastNoise
22
cmake_minimum_required(VERSION 3.7.1)
33

4-
project(FastNoise2 VERSION 0.8.0)
4+
project(FastNoise2 VERSION 0.8.1)
55
set(CMAKE_CXX_STANDARD 17)
66

77
option(FASTNOISE2_NOISETOOL "Build Noise Tool" ON)

NoiseTool/FastNoiseNodeEditor.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,11 @@ void FastNoiseNodeEditor::CheckLinks()
394394
void FastNoiseNodeEditor::UpdateSelected()
395395
{
396396
std::vector<int> linksToDelete;
397+
int selectedLinkCount = imnodes::NumSelectedLinks();
397398

398-
if( int selectedCount = imnodes::NumSelectedLinks() && ImGui::IsKeyPressed( ImGui::GetKeyIndex( ImGuiKey_Delete ), false ) )
399+
if( selectedLinkCount && ImGui::IsKeyPressed( ImGui::GetKeyIndex( ImGuiKey_Delete ), false ) )
399400
{
400-
linksToDelete.resize( selectedCount );
401+
linksToDelete.resize( selectedLinkCount );
401402
imnodes::GetSelectedLinks( linksToDelete.data() );
402403
}
403404

@@ -432,9 +433,11 @@ void FastNoiseNodeEditor::UpdateSelected()
432433
}
433434
}
434435

435-
if( int selectedCount = imnodes::NumSelectedNodes() && ImGui::IsKeyPressed( ImGui::GetKeyIndex( ImGuiKey_Delete ), false ) )
436+
int selectedNodeCount = imnodes::NumSelectedNodes();
437+
438+
if( selectedNodeCount && ImGui::IsKeyPressed( ImGui::GetKeyIndex( ImGuiKey_Delete ), false ) )
436439
{
437-
std::vector<int> selected( selectedCount );
440+
std::vector<int> selected( selectedNodeCount );
438441

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

0 commit comments

Comments
 (0)