X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-mod-failsafe%2Fluasrc%2Fcontroller%2Ffailsafe%2Ffailsafe.lua;h=60caadb4b1fc498163dbcb8325a28f3b619fc2a8;hp=6f78643018ccdc95daf28524ba39903bc6ed806e;hb=a16654b12130d636b4e0f81839a26f5821619baa;hpb=41d2b33087da393453c45f5d923d690c88ee5474 diff --git a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua index 6f7864301..60caadb4b 100644 --- a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua +++ b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua @@ -84,11 +84,13 @@ function action_flashops() fp = io.open(image_tmp, "w") end end - if chunk then - fp:write(chunk) - end - if eof then - fp:close() + if fp then + if chunk then + fp:write(chunk) + end + if eof then + fp:close() + end end end )