Changeset

6998:86607fe755b6

util.datamanager: Handle potential error from :write() call
author Kim Alvefur <zash@zash.se>
date Fri, 11 Dec 2015 20:26:04 +0100
parents 6997:0ab228bc21c6
children 6999:0ad66d12113a
files util/datamanager.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/util/datamanager.lua	Fri Dec 11 20:24:36 2015 +0100
+++ b/util/datamanager.lua	Fri Dec 11 20:26:04 2015 +0100
@@ -232,9 +232,9 @@
 		f:seek("set", pos);
 	end
 
-	if ok then
-		f:write(data);
-	else
+	ok, msg = f:write(data);
+	if not ok then
+		f:close();
 		return ok, msg;
 	end