From 50963df42feda126b9973491ee0d2146684b671e Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Sat, 11 May 2024 13:29:40 +0100 Subject: [PATCH] Update mongoose.c --- mongoose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 210e2c0f..ba2dc8e9 100644 --- a/mongoose.c +++ b/mongoose.c @@ -2789,7 +2789,7 @@ void mg_http_serve_file(struct mg_connection *c, struct mg_http_message *hm, struct mg_str *ae = mg_http_get_header(hm, "Accept-Encoding"); if (ae != NULL) { char *ae_ = mg_mprintf("%.*s", ae->len, ae->buf); - if (strstr(ae_, "gzip") != NULL) { + if (ae_ != NULL && strstr(ae_, "gzip") != NULL) { mg_snprintf(tmp, sizeof(tmp), "%s.gz", path); fd = mg_fs_open(fs, tmp, MG_FS_READ); if (fd != NULL) gzip = true, path = tmp;