Skip to content

Commit

Permalink
fix mutating list while iterating over it
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 committed Oct 13, 2022
1 parent 0c7f4a4 commit e7c7f86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dsymbol/src/dsymbol/modulecache.d
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ struct ModuleCache
*/
void removeImportPaths(const string[] paths)
{
import std.array : array;

foreach (path; paths[])
{
if (!importPaths[].canFind!(a => a.path == path))
Expand All @@ -115,7 +117,7 @@ struct ModuleCache
continue;
}

foreach (ref importPath; importPaths[].filter!(a => a.path == path))
foreach (ref importPath; importPaths[].filter!(a => a.path == path).array)
importPaths.remove(importPath);

foreach (cacheEntry; cache[])
Expand Down

0 comments on commit e7c7f86

Please sign in to comment.