about summary refs log tree commit diff stats
path: root/src/lua.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-11 17:04:29 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-11 17:04:29 -0800
commit4d20e71c80b61f96ca398110f046ead8d004ee1b (patch)
treef700144600a55c0f9ae222b1a15399208dd0103d /src/lua.c
parent8398f8e2d1cfe0b448ec878b4efd56a8f7fca91f (diff)
downloadteliva-4d20e71c80b61f96ca398110f046ead8d004ee1b.tar.gz
gracefully handle missing definition
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lua.c b/src/lua.c
index 5c484b9..e75ba92 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -314,6 +314,7 @@ void write_definition_to_file (lua_State *L, char *name, char *outfilename) {
     lua_getfield(L, -1, name);
     const char *contents = lua_tostring(L, -1);
     lua_pop(L, 1);
+    if (contents == NULL) return;
     int outfd = open(outfilename, O_WRONLY|O_CREAT|O_TRUNC, 0644);
     write(outfd, contents, strlen(contents));
     close(outfd);