From: Jérémie Astor Date: Mon, 13 Apr 2020 20:57:02 +0000 (+0200) Subject: :bug: Fix segfault when input string is empty X-Git-Tag: nightly~1698 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=881c620a3e642d7ebe6516c1065866a7c53fb832;p=gwion.git :bug: Fix segfault when input string is empty --- diff --git a/src/compile.c b/src/compile.c index 4d67706c..2f9cca9f 100644 --- a/src/compile.c +++ b/src/compile.c @@ -62,7 +62,7 @@ ANN static m_bool _compiler_open(struct Compiler* c) { xfree(name); return c->name ? !!(c->file = fopen(c->name, "r")) : GW_ERROR; } else if(c->type == COMPILE_MSTR) { - c->file = fmemopen(c->data, strlen(c->data), "r"); + c->file = c->data ? fmemopen(c->data, strlen(c->data), "r") : NULL; return c->file ? GW_OK : GW_ERROR; } return GW_OK;