Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit

Permalink
Merge branch '4651_mouse_drag_segfault'
Browse files Browse the repository at this point in the history
* 4651_mouse_drag_segfault:
  (panel_mouse_is_on_item): fix return value
  Ticket #4651: segfault when dragging mouse in half-empty panel.
  • Loading branch information
aborodin committed Feb 17, 2025
2 parents ee8b381 + 130d0f0 commit 9f020f7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/filemanager/panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2061,8 +2061,14 @@ move_down (WPanel *panel)
{
int items;

if (panel->dir.len == 0 || panel->current + 1 == panel->dir.len)
if (panel->dir.len == 0)
return;

if (panel->current >= panel->dir.len - 1)
{
panel->current = panel->dir.len - 1;
return;
}

unselect_item (panel);
panel->current++;
Expand Down Expand Up @@ -3944,7 +3950,7 @@ panel_mouse_is_on_item (const WPanel *panel, int y, int x)
y += panel->top + lines * col;

// are we below or in the next column of last file?
if (y > panel->dir.len)
if (y >= panel->dir.len)
return MOUSE_AFTER_LAST_FILE;

// we are on item of the file file; return an index to select a file
Expand Down

0 comments on commit 9f020f7

Please sign in to comment.