[Bf-blender-cvs] [9e3cd98529d] master: Fix T69451: Walk-select in empty directory asserts

Julian Eisel noreply at git.blender.org
Tue Sep 3 19:52:17 CEST 2019


Commit: 9e3cd98529dc2f8dbb00357126d5286ee74fae1f
Author: Julian Eisel
Date:   Tue Sep 3 19:50:04 2019 +0200
Branches: master
https://developer.blender.org/rB9e3cd98529dc2f8dbb00357126d5286ee74fae1f

Fix T69451: Walk-select in empty directory asserts

Code assumed the '..' was there, which isn't the case any more. Just
early exiting for empty directories is fine.

===================================================================

M	source/blender/editors/space_file/file_ops.c

===================================================================

diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index bd018581d32..d738a20bf53 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -584,6 +584,11 @@ static bool file_walk_select_selection_set(bContext *C,
 
   BLI_assert(params);
 
+  if (numfiles == 0) {
+    /* No files visible, nothing to do. */
+    return false;
+  }
+
   if (has_selection) {
     if (extend && filelist_entry_select_index_get(files, active_old, CHECK_ALL) &&
         filelist_entry_select_index_get(files, active_new, CHECK_ALL)) {
@@ -692,6 +697,11 @@ static bool file_walk_select_do(bContext *C,
 
   /* *** get all needed files for handling selection *** */
 
+  if (numfiles == 0) {
+    /* No files visible, nothing to do. */
+    return false;
+  }
+
   if (has_selection) {
     ARegion *ar = CTX_wm_region(C);
     FileLayout *layout = ED_fileselect_get_layout(sfile, ar);



More information about the Bf-blender-cvs mailing list