Skip to content

Commit

Permalink
gui: fix crash when entering node editor
Browse files Browse the repository at this point in the history
  • Loading branch information
hanatos committed Dec 20, 2023
1 parent 7a257bd commit 56d06d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gui/render_nodes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ void render_nodes()
if(ImNodes::NumSelectedNodes() == 1)
{
ImNodes::GetSelectedNodes(&mid);
if(g->module[mid].so->has_inout_chain)
if(mid >= 0 && mid < g->num_modules && g->module[mid].so->has_inout_chain)
{
int mco = dt_module_get_connector(g->module+mid, dt_token("output"));
int mci = dt_module_get_connector(g->module+mid, dt_token("input"));
Expand Down Expand Up @@ -554,6 +554,7 @@ extern "C" int nodes_enter()

extern "C" int nodes_leave()
{
ImNodes::ClearNodeSelection(); // don't leave stray selection. leads to problems re-entering with another graph.
dt_graph_t *g = &vkdt.graph_dev;
for(uint32_t m=0;m<g->num_modules;m++)
{ // set gui positions on modules
Expand Down

0 comments on commit 56d06d8

Please sign in to comment.