commit 266e842: [Minor] Fix the case when filename is empty for an image

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Mar 25 13:49:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-03-25 13:48:06 +0000
URL: https://github.com/rspamd/rspamd/commit/266e842936768e42167eb67f2c73490c7da67ede (HEAD -> master)

[Minor] Fix the case when filename is empty for an image
Issue: #2818
Closes: #2818

---
 src/lua/lua_task.c | 9 +++++++--
 1 file 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");


More information about the Commits mailing list