aboutsummaryrefslogtreecommitdiff
path: root/src/nix/why-depends.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-13 16:12:16 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-13 16:12:16 +0100
commitd8972317fc4314864619cadd5620ae780da657a3 (patch)
tree36ae248e7e893bfa14f30acd619cd3b7ee98143b /src/nix/why-depends.cc
parent94c934370225a5e1fbf84959fc759b19893c2081 (diff)
Prevent uninitialized StorePath creation
Diffstat (limited to 'src/nix/why-depends.cc')
-rw-r--r--src/nix/why-depends.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc
index 8566e5851..c24ae7c8e 100644
--- a/src/nix/why-depends.cc
+++ b/src/nix/why-depends.cc
@@ -103,7 +103,7 @@ struct CmdWhyDepends : SourceExprCommand
std::map<StorePath, Node> graph;
for (auto & path : closure)
- graph.emplace(path.clone(), Node{path.clone(), cloneStorePathSet(store->queryPathInfo(path)->references)});
+ graph.emplace(path.clone(), Node { .path = path.clone(), .refs = cloneStorePathSet(store->queryPathInfo(path)->references) });
// Transpose the graph.
for (auto & node : graph)
@@ -112,7 +112,7 @@ struct CmdWhyDepends : SourceExprCommand
/* Run Dijkstra's shortest path algorithm to get the distance
of every path in the closure to 'dependency'. */
- graph[dependencyPath.clone()].dist = 0;
+ graph.emplace(dependencyPath.clone(), Node { .path = dependencyPath.clone(), .dist = 0 });
std::priority_queue<Node *> queue;