Avoid asserts when moving mouse in empty wxGridColLabelWindow too

The changes of the previous commit were insufficient, as we could also
use an invalid column index when handling mouse event in an empty grid.

Fix this by checking for the line validity in PosToEdgeOfLine() instead
of adding another ad hoc check to wxGridColLabelWindow itself, as it
seems reasonable for this function to verify that it uses valid indices.

See #18629.
This commit is contained in:
Vadim Zeitlin
2019-12-14 00:03:01 +01:00
parent 9c1e8fde8f
commit 55f148a2ea

View File

@@ -7345,6 +7345,9 @@ int wxGrid::PosToEdgeOfLine(int pos, const wxGridOperations& oper) const
// Get the bottom or rightmost line that could match.
int line = oper.PosToLine(this, pos, NULL, true);
if ( line == wxNOT_FOUND )
return -1;
if ( oper.GetLineSize(this, line) > WXGRID_LABEL_EDGE_ZONE )
{
// We know that we are in this line, test whether we are close enough