diff src/view_file_list.c @ 1233:b51874ca8642

fixed updating of selection after deleting the last image from the list
author nadvornik
date Fri, 02 Jan 2009 23:14:01 +0000
parents d79305a42a9b
children 947e603a52c6
line wrap: on
line diff
--- a/src/view_file_list.c	Fri Jan 02 22:57:09 2009 +0000
+++ b/src/view_file_list.c	Fri Jan 02 23:14:01 2009 +0000
@@ -1518,6 +1518,7 @@
 static void vflist_select_closest(ViewFile *vf, FileData *sel_fd)
 {
 	GList *work;
+	FileData *fd = NULL;
 	
 	if (sel_fd->parent) sel_fd = sel_fd->parent;
 	work = vf->list;
@@ -1525,19 +1526,16 @@
 	while (work)
 		{
 		gint match;
-		FileData *fd = work->data;
+		fd = work->data;
 		work = work->next;
-		
 
 		match = filelist_sort_compare_filedata_full(fd, sel_fd, vf->sort_method, vf->sort_ascend);
 		
-		if (match >= 0)
-			{
-			vflist_select_by_fd(vf, fd);
-			break;
-			}
+		if (match >= 0) break;
 		}
 
+	if (fd) vflist_select_by_fd(vf, fd);
+
 }
 
 void vflist_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode)