Skip to content

Commit beb42ff

Browse files
authored
common : check for null getpwuid in hf-cache (ggml-org#22550)
Signed-off-by: Adrien Gallouët <angt@huggingface.co>
1 parent 660b1b4 commit beb42ff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

common/hf-cache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static fs::path get_cache_directory() {
5757
#ifndef _WIN32
5858
const struct passwd * pw = getpwuid(getuid());
5959

60-
if (pw->pw_dir && *pw->pw_dir) {
60+
if (pw && pw->pw_dir && *pw->pw_dir) {
6161
return fs::path(pw->pw_dir) / ".cache" / "huggingface" / "hub";
6262
}
6363
#endif

0 commit comments

Comments
 (0)