about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-28 15:55:01 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-28 15:55:01 -0800
commit383832b58bf496744aa1e5a8d70ee89612240c8a (patch)
tree3b60803d3e9bd10b2beea1b7e05bfb1226f4ca91 /src
parent2ea9462ed15e8fb62568adebbb05884f33b813ff (diff)
downloadteliva-383832b58bf496744aa1e5a8d70ee89612240c8a.tar.gz
sacrificing another LoC to ward off crashes
It makes me very nervous now that there's save_editor_state within
editor event loop, when the editor could be editing notes. Things are
slightly better than this morning, but this prototype still suxxors.
Diffstat (limited to 'src')
-rw-r--r--src/lua.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lua.c b/src/lua.c
index b17b7db..6362c38 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -404,6 +404,7 @@ static int handle_image (lua_State *L, char **argv, int n) {
 char Current_definition[CURRENT_DEFINITION_LEN+1] = {0};
 
 void save_editor_state (int rowoff, int coloff, int cy, int cx) {
+  if (strlen(Current_definition) == 0) return;
   FILE *out = fopen("teliva_editor_state", "w");
   fprintf(out, "__teliva_editor_state = {\n");
   fprintf(out, "  image = \"%s\", definition = \"%s\",\n", Image_name, Current_definition);