Check for column existence before checking for tooltip enabled

Otherwise we try to read a bitset at location -1, which triggers
and assert on MSVC.

Fixes https://gitlab.com/kicad/code/kicad/issues/8890
This commit is contained in:
Ian McInerney 2021-07-29 23:17:41 +01:00
parent c716548b29
commit baf6798695
1 changed files with 2 additions and 9 deletions

View File

@ -180,17 +180,10 @@ void GRID_TRICKS::onGridMotion( wxMouseEvent& aEvent )
wxPoint pos = m_grid->CalcScrolledPosition( wxPoint( pt.x, pt.y ) ); wxPoint pos = m_grid->CalcScrolledPosition( wxPoint( pt.x, pt.y ) );
int col = m_grid->XToCol( pos.x ); int col = m_grid->XToCol( pos.x );
// Skip the event if the tooltip shouldn't be shown
if( !m_tooltipEnabled[col] || ( col == wxNOT_FOUND ) )
{
m_grid->GetGridWindow()->SetToolTip( "" );
return;
}
int row = m_grid->YToRow( pos.y ); int row = m_grid->YToRow( pos.y );
if( row == wxNOT_FOUND ) // Empty tooltip if the cell doesn't exist or the column doesn't have tooltips
if( ( col == wxNOT_FOUND ) || ( row == wxNOT_FOUND ) || !m_tooltipEnabled[col] )
{ {
m_grid->GetGridWindow()->SetToolTip( "" ); m_grid->GetGridWindow()->SetToolTip( "" );
return; return;