From beb42fffa45eded44804a1fd4916146222371581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Thu, 30 Apr 2026 21:32:41 +0200 Subject: [PATCH] common : check for null getpwuid in hf-cache (#22550) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- common/hf-cache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/hf-cache.cpp b/common/hf-cache.cpp index ea5b2150de..20f33e4c7f 100644 --- a/common/hf-cache.cpp +++ b/common/hf-cache.cpp @@ -57,7 +57,7 @@ static fs::path get_cache_directory() { #ifndef _WIN32 const struct passwd * pw = getpwuid(getuid()); - if (pw->pw_dir && *pw->pw_dir) { + if (pw && pw->pw_dir && *pw->pw_dir) { return fs::path(pw->pw_dir) / ".cache" / "huggingface" / "hub"; } #endif