]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix the case when filename is empty for an image
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 25 Mar 2019 13:48:06 +0000 (13:48 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 25 Mar 2019 13:48:06 +0000 (13:48 +0000)
Issue: #2818
Closes: #2818
src/lua/lua_task.c

index 650c2281cb8c9a3a5791fbfd804a0106b3b6bf6d..92ae7e9d1779be65a1c8491b4158acbd35320701 100644 (file)
@@ -5653,8 +5653,13 @@ lua_image_get_filename (lua_State *L)
        LUA_TRACE_POINT;
        struct rspamd_image *img = lua_check_image (L);
 
-       if (img != NULL && img->filename != NULL) {
-               lua_pushlstring (L, img->filename->begin, img->filename->len);
+       if (img != NULL) {
+               if (img->filename != NULL) {
+                       lua_pushlstring (L, img->filename->begin, img->filename->len);
+               }
+               else {
+                       lua_pushnil (L);
+               }
        }
        else {
                return luaL_error (L, "invalid arguments");