about summary refs log tree commit diff stats
path: root/src/teliva.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-01-04 22:09:42 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-01-04 22:09:42 -0800
commit855eafd1d9fea90aaaea74b95986e437d9d88a38 (patch)
treed11e21fe0ad1dfe2a1c2844b27e6222bf9eeba66 /src/teliva.c
parent64f8a1e15d8fc3343ef44fdbadbe6c5dd350c89a (diff)
downloadteliva-855eafd1d9fea90aaaea74b95986e437d9d88a38.tar.gz
slightly better error message
Diffstat (limited to 'src/teliva.c')
-rw-r--r--src/teliva.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/teliva.c b/src/teliva.c
index f230ef0..0beff0d 100644
--- a/src/teliva.c
+++ b/src/teliva.c
@@ -1212,7 +1212,12 @@ int file_operation_permitted(const char* filename, const char* mode) {
   if (lua_pcall(trustedL, 2 /*args*/, 1 /*result*/, /*errfunc*/0)) {
     /* TODO: error handling. Or should we use errfunc above? */
   }
-  assert(lua_isboolean(trustedL, -1));
+  if (!lua_isboolean(trustedL, -1)) {
+    endwin();
+    printf("Sorry, there's an error in permissions for this image.\n");
+    printf("Delete '%s' or try editing it by hand.\n", user_configuration_filename());
+    exit(1);
+  }
   int should_allow = lua_toboolean(trustedL, -1);
   lua_settop(trustedL, oldtop);
   return should_allow;