From 651e62781fd8987c09a965829546a52937bd3461 Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Tue, 5 Mar 2024 03:49:51 +0100 Subject: [PATCH] libfetchers/git: use unique_ptr::get() instead of operator*() According to N4950 20.3.1.3.5 [unique.ptr.single.observers]/1, the behavior is undefined if get() == nullptr. Use get() instead of operator*() on a possibly-null unique_ptr. Fixes #10123. --- src/libfetchers/git-utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libfetchers/git-utils.cc b/src/libfetchers/git-utils.cc index 8fcfc4b0d..5486ab778 100644 --- a/src/libfetchers/git-utils.cc +++ b/src/libfetchers/git-utils.cc @@ -590,7 +590,7 @@ struct GitInputAccessor : InputAccessor i = lookupCache.emplace(path, std::move(entry)).first; } - return &*i->second; + return i->second.get(); } git_tree_entry * need(const CanonPath & path)