From ffa9857ff18daa3e456ec4e3b171dbe0295ba603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= Date: Wed, 9 Sep 2020 17:59:57 +0200 Subject: [PATCH] ftp: guard against nil file (#6640) Fixes #6636 --- frontend/apps/cloudstorage/ftp.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/apps/cloudstorage/ftp.lua b/frontend/apps/cloudstorage/ftp.lua index 3f59f0968..61a1286b8 100644 --- a/frontend/apps/cloudstorage/ftp.lua +++ b/frontend/apps/cloudstorage/ftp.lua @@ -25,7 +25,13 @@ function Ftp:downloadFile(item, address, user, pass, path, close) local response = FtpApi:ftpGet(url, "retr") if response ~= nil then path = util.fixUtf8(path, "_") - local file = io.open(path, "w") + local file, err = io.open(path, "w") + if not file then + UIManager:show(InfoMessage:new{ + text = T(_("Could not save file to %1:\n%2"), BD.filepath(path), err), + }) + return + end file:write(response) file:close() local __, filename = util.splitFilePathName(path)