AlanQuatermain / AQGridView

A grid view for iPhone/iPad, designed to look similar to NSCollectionView.
http://quatermain.tumblr.com/
BSD 3-Clause "New" or "Revised" License
2.37k stars 450 forks source link

NSNotFound does not prevent selection in develop branch #179

Closed karmeye closed 1 year ago

karmeye commented 12 years ago

Crash with NSRangeException.

Can be fixed by adding i check in _selectItemAtIndex. Do not know if its good solution.

        if (notifiesWillSelect)
            index = [delegate gridView:self willSelectItemAtIndex:index];

        if (notifiesWillSelectMultitouch)
            index = [delegate gridView:self willSelectItemAtIndex:index numFingersTouch:numFingers];

        if (index == NSNotFound)
            return;

        [_selectedIndices addIndex:index];
AlanQuatermain commented 12 years ago

Looks like the right fix to me— never trust the user ;o)

On 2012-11-13, at 9:20 AM, rassol notifications@github.com wrote:

Crash with NSRangeException.

Can be fixed by adding i check in _selectItemAtIndex. Do not know if its good solution.

    if (notifiesWillSelect)
        index = [delegate gridView:self willSelectItemAtIndex:index];

    if (notifiesWillSelectMultitouch)
        index = [delegate gridView:self willSelectItemAtIndex:index numFingersTouch:numFingers];

    if (index == NSNotFound)
        return;

    [_selectedIndices addIndex:index];

— Reply to this email directly or view it on GitHub.

Cheers, -Jim

jimdovey@(mac|gmail).com http://twitter.com/alanQuatermain http://github.com/alanQuatermain http://stackoverflow.com/users/103900/jim-dovey http://ca.linkedin.com/pub/jim-dovey/2/24b/883