Browse Source

Fixing 8e197efb when opening another path that on different drive or with some path component with same name but in a different tree

Source commit: 44cffcdf273d564c8ad0ae823f5d7e91f3e1d18b
Martin Prikryl 1 year ago
parent
commit
de03b99d65
1 changed files with 6 additions and 1 deletions
  1. 6 1
      source/packages/filemng/DriveView.pas

+ 6 - 1
source/packages/filemng/DriveView.pas

@@ -1929,6 +1929,9 @@ var
     end
       else
     begin
+      // Paths have diverted
+      SelectionHierarchyHeight := 0;
+
       Node := ParentNode.GetFirstChild;
       if (not Assigned(Node)) and (not ExistingOnly) then
       begin
@@ -2077,7 +2080,9 @@ begin {FindNodeToPath}
           Node := Node.Parent;
         end;
         Assert(Selected = SelectionHierarchy[SelectionHierarchyHeight - 1]);
-        Assert(RootNode = SelectionHierarchy[0]);
+        // Different drive - nothing to optimize
+        if RootNode <> SelectionHierarchy[0] then
+          SelectionHierarchyHeight := 0;
       end;
       Result := SearchSubDirs(RootNode, UpperCase(Path), 1);
     end