Skip to content

Commit

Permalink
Fix segfault when no tools are available (#1729)
Browse files Browse the repository at this point in the history
In that case, current_tool_ is NULL...
  • Loading branch information
rhaschke authored Mar 18, 2022
1 parent 16df936 commit 23607d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rviz/tool_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void ToolManager::handleChar(QKeyEvent* event, RenderPanel* panel)
else
{
// if no, check if the current tool accesses all key events
if (current_tool_->accessAllKeys())
if (current_tool_ && current_tool_->accessAllKeys())
{
// if yes, pass the key
current_tool_->processKeyEvent(event, panel);
Expand All @@ -161,7 +161,7 @@ void ToolManager::handleChar(QKeyEvent* event, RenderPanel* panel)
}
}
}
else
else if (current_tool_)
{
// if the incoming key triggers no other tool,
// just hand down the key event
Expand Down

0 comments on commit 23607d9

Please sign in to comment.