aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-07-05 09:44:59 +0100
committerrxi <rxi@users.noreply.github.com>2020-07-05 09:44:59 +0100
commitc2113fd151236dd8ad613746513ad3d7a0ee1225 (patch)
treefd70ac7583aeb921b1881e8d55e585eee8d43dc9
parent7c77845a02cc909bf238a2ea1bb4db60045f58b8 (diff)
downloadlite-xl-plugins-c2113fd151236dd8ad613746513ad3d7a0ee1225.tar.gz
lite-xl-plugins-c2113fd151236dd8ad613746513ad3d7a0ee1225.zip
Accounted for file-write failure when saving workspace
Resolves #74
-rw-r--r--plugins/workspace.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/workspace.lua b/plugins/workspace.lua
index 8f8dfcc..028e0a2 100644
--- a/plugins/workspace.lua
+++ b/plugins/workspace.lua
@@ -126,8 +126,10 @@ end
local function save_workspace()
local root = get_unlocked_root(core.root_view.root_node)
local fp = io.open(workspace_filename, "w")
- fp:write("return ", serialize(save_node(root)), "\n")
- fp:close()
+ if fp then
+ fp:write("return ", serialize(save_node(root)), "\n")
+ fp:close()
+ end
end