mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 02:41:01 +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 betweenCols;
|
||||||
BOOL beyondRows;
|
BOOL beyondRows;
|
||||||
BOOL beyondCols;
|
BOOL beyondCols;
|
||||||
|
BOOL nullMatrix = NO;
|
||||||
int approxRow = point.y / (cellSize.height + intercell.height);
|
int approxRow = point.y / (cellSize.height + intercell.height);
|
||||||
float approxRowsHeight = approxRow * (cellSize.height + intercell.height);
|
float approxRowsHeight = approxRow * (cellSize.height + intercell.height);
|
||||||
int approxCol = point.x / (cellSize.width + intercell.width);
|
int approxCol = point.x / (cellSize.width + intercell.width);
|
||||||
|
@ -693,6 +694,11 @@ static SEL getSel = @selector(objectAtIndex:);
|
||||||
approxRow = 0;
|
approxRow = 0;
|
||||||
else if (approxRow >= numRows)
|
else if (approxRow >= numRows)
|
||||||
approxRow = numRows - 1;
|
approxRow = numRows - 1;
|
||||||
|
if (numRows == 0)
|
||||||
|
{
|
||||||
|
nullMatrix = YES;
|
||||||
|
approxRow = 0;
|
||||||
|
}
|
||||||
*row = approxRow;
|
*row = approxRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,10 +708,15 @@ static SEL getSel = @selector(objectAtIndex:);
|
||||||
approxCol = 0;
|
approxCol = 0;
|
||||||
else if (approxCol >= numCols)
|
else if (approxCol >= numCols)
|
||||||
approxCol = numCols - 1;
|
approxCol = numCols - 1;
|
||||||
|
if (numCols == 0)
|
||||||
|
{
|
||||||
|
nullMatrix = YES;
|
||||||
|
approxCol = 0;
|
||||||
|
}
|
||||||
*column = approxCol;
|
*column = approxCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beyondRows || betweenRows || beyondCols || betweenCols)
|
if (beyondRows || betweenRows || beyondCols || betweenCols || nullMatrix)
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue