Skip to content

Commit

Permalink
hiro/cocoa: Add bounds checking for table view context menus (#1650)
Browse files Browse the repository at this point in the history
Right-clicking in a table view beyond the bounds of the defined rows in
the table would crash previously.
  • Loading branch information
jcm93 authored Sep 25, 2024
1 parent d6858ad commit 025fc64
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hiro/cocoa/widget/table-view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@
NSPoint localPoint = [self convertPoint:event.locationInWindow fromView:nil];
NSInteger row = [self rowAtPoint:localPoint];
NSInteger column = [self columnAtPoint:localPoint];


if (row < 0 || row >= tableView->state.items.size()) {
return nil;
}

if (row >= 0 && ![self isRowSelected:row]) {
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
Expand Down

0 comments on commit 025fc64

Please sign in to comment.