summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_areastore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api/l_areastore.cpp')
-rw-r--r--src/script/lua_api/l_areastore.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/script/lua_api/l_areastore.cpp b/src/script/lua_api/l_areastore.cpp
index 20e7875c7..09a5c78f9 100644
--- a/src/script/lua_api/l_areastore.cpp
+++ b/src/script/lua_api/l_areastore.cpp
@@ -111,6 +111,9 @@ int LuaAreaStore::l_get_area(lua_State *L)
const Area *res;
res = ast->getArea(id);
+ if (!res)
+ return 0;
+
push_area(L, res, include_borders, include_data);
return 1;
@@ -260,7 +263,7 @@ int LuaAreaStore::l_to_file(lua_State *L)
AreaStore *ast = o->as;
const char *filename = luaL_checkstring(L, 2);
- CHECK_SECURE_PATH_OPTIONAL(L, filename);
+ CHECK_SECURE_PATH(L, filename, true);
std::ostringstream os(std::ios_base::binary);
ast->serialize(os);
@@ -291,7 +294,7 @@ int LuaAreaStore::l_from_file(lua_State *L)
LuaAreaStore *o = checkobject(L, 1);
const char *filename = luaL_checkstring(L, 2);
- CHECK_SECURE_PATH_OPTIONAL(L, filename);
+ CHECK_SECURE_PATH(L, filename, false);
std::ifstream is(filename, std::ios::binary);
return deserialization_helper(L, o->as, is);