mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 23:31:02 +00:00
Fix mouse click on empty matrix so it does not crash
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5569 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fcb9c37b09
commit
ec2960c8a5
1 changed files with 12 additions and 1 deletions
|
@ -669,6 +669,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
BOOL betweenCols;
|
||||
BOOL beyondRows;
|
||||
BOOL beyondCols;
|
||||
BOOL nullMatrix = NO;
|
||||
int approxRow = point.y / (cellSize.height + intercell.height);
|
||||
float approxRowsHeight = approxRow * (cellSize.height + intercell.height);
|
||||
int approxCol = point.x / (cellSize.width + intercell.width);
|
||||
|
@ -693,6 +694,11 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
approxRow = 0;
|
||||
else if (approxRow >= numRows)
|
||||
approxRow = numRows - 1;
|
||||
if (numRows == 0)
|
||||
{
|
||||
nullMatrix = YES;
|
||||
approxRow = 0;
|
||||
}
|
||||
*row = approxRow;
|
||||
}
|
||||
|
||||
|
@ -702,10 +708,15 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
approxCol = 0;
|
||||
else if (approxCol >= numCols)
|
||||
approxCol = numCols - 1;
|
||||
if (numCols == 0)
|
||||
{
|
||||
nullMatrix = YES;
|
||||
approxCol = 0;
|
||||
}
|
||||
*column = approxCol;
|
||||
}
|
||||
|
||||
if (beyondRows || betweenRows || beyondCols || betweenCols)
|
||||
if (beyondRows || betweenRows || beyondCols || betweenCols || nullMatrix)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue