Browse Source

Minor sanity check.

Marco Bambini 7 years ago
parent
commit
f5bb91c47e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/compiler/gravity_compiler.c

+ 2 - 0
src/compiler/gravity_compiler.c

@@ -186,6 +186,7 @@ abort_compilation:
 
 json_t *gravity_compiler_serialize (gravity_compiler_t *compiler, gravity_closure_t *closure) {
 	#pragma unused(compiler)
+	if (!closure) return NULL;
 
 	json_t *json = json_new();
 	json_begin_object(json, NULL);
@@ -200,6 +201,7 @@ bool gravity_compiler_serialize_infile (gravity_compiler_t *compiler, gravity_cl
 	if (!closure) return false;
 	json_t *json = gravity_compiler_serialize(compiler, closure);
 	if (!json) return false;
+	
 	json_write_file(json, path);
 	json_free(json);
 	return true;