diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-11 17:04:29 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-11 17:04:29 -0800 |
commit | 4d20e71c80b61f96ca398110f046ead8d004ee1b (patch) | |
tree | f700144600a55c0f9ae222b1a15399208dd0103d /src | |
parent | 8398f8e2d1cfe0b448ec878b4efd56a8f7fca91f (diff) | |
download | teliva-4d20e71c80b61f96ca398110f046ead8d004ee1b.tar.gz |
gracefully handle missing definition
Diffstat (limited to 'src')
-rw-r--r-- | src/lua.c | 1 |
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); |