From: Stephen Seo Date: Wed, 30 Oct 2024 05:29:03 +0000 (+0900) Subject: Fix test crashing if "xdg-mime" did not exist X-Git-Tag: 1.0~16 X-Git-Url: https://git.seodisparate.com/stephenseo/static/annotated.html?a=commitdiff_plain;h=8d2e5f52a4fdbd6f6bc05622be51d8c39f31f920;p=c_simple_http Fix test crashing if "xdg-mime" did not exist --- 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());