From 8d2e5f52a4fdbd6f6bc05622be51d8c39f31f920 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Wed, 30 Oct 2024 14:29:03 +0900 Subject: [PATCH] Fix test crashing if "xdg-mime" did not exist --- src/test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test.c b/src/test.c index 66240a1..2f2b03e 100644 --- a/src/test.c +++ b/src/test.c @@ -979,7 +979,9 @@ int main(int argc, char **argv) { { FILE *fd = fopen("/usr/bin/xdg-mime", "rb"); int_fast8_t is_xdg_mime_exists = fd ? 1 : 0; - fclose(fd); + if (fd) { + fclose(fd); + } if (is_xdg_mime_exists) { CHECK_TRUE(c_simple_http_is_xdg_mime_available());