aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-25 13:48:06 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-25 13:48:06 +0000
commit266e842936768e42167eb67f2c73490c7da67ede (patch)
tree5f3382d1bb1be43ddaea83a86915bb21f26e7bc6 /src/lua
parent373090429416571046f333c1f68707bb752e562d (diff)
downloadrspamd-266e842936768e42167eb67f2c73490c7da67ede.tar.gz
rspamd-266e842936768e42167eb67f2c73490c7da67ede.zip
[Minor] Fix the case when filename is empty for an image
Issue: #2818 Closes: #2818
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_task.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 650c2281c..92ae7e9d1 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -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");