From 881c620a3e642d7ebe6516c1065866a7c53fb832 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 13 Apr 2020 22:57:02 +0200 Subject: [PATCH] :bug: Fix segfault when input string is empty --- src/compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.43.0