diff --git a/src/map.c b/src/map.c
index 595531ffe6784d95a8a9753aebc7b8ff43cd2e8f..95c03f2c3a92a0cadc7a0829c394916e291c31df 100644
--- a/src/map.c
+++ b/src/map.c
@@ -55,6 +55,8 @@ static int map_object_new(lua_State *L)
 
 	obj->move_max = 0;
 
+	obj->closed = FALSE;
+
 	obj->cb_ref = LUA_NOREF;
 
 	obj->mm_r = -1;
@@ -86,6 +88,8 @@ static int map_object_free(lua_State *L)
 	map_object *obj = (map_object*)auxiliar_checkclass(L, "core{mapobj}", 1);
 	int i;
 
+	obj->closed = TRUE;
+
 	for (i = 0; i < obj->nb_textures; i++)
 		if (obj->textures_ref[i] != LUA_NOREF)
 			luaL_unref(L, LUA_REGISTRYINDEX, obj->textures_ref[i]);
@@ -1085,6 +1089,8 @@ void display_map_quad(GLuint *cur_tex, int *vert_idx, int *col_idx, map_type *ma
 	GLfloat *colors = map->colors;
 	GLfloat *texcoords = map->texcoords;
 
+	if (m->closed) exit(2);
+
 	/********************************************************
 	 ** Select the color to use
 	 ********************************************************/
@@ -1207,6 +1213,7 @@ void display_map_quad(GLuint *cur_tex, int *vert_idx, int *col_idx, map_type *ma
 	dm = m;
 	while (dm)
 	{
+		if (dm->closed) exit(3);
 		tglBindTexture(GL_TEXTURE_2D, dm->textures[0]);
 		DO_QUAD(dm, dx + (dm->dx + animdx) * map->tile_w, dy + (dm->dy + animdy) * map->tile_h, dm->dw, dm->dh, dm->scale, r, g, b, a, m->next);
 		dm->animdx = animdx;
diff --git a/src/map.h b/src/map.h
index 6b1c18ff153bcb9ac1bbdca232ac022b60639d66..4aba6b225192f68d90ba8cc5f93484986191ff8b 100644
--- a/src/map.h
+++ b/src/map.h
@@ -52,6 +52,8 @@ struct s_map_object {
 
 	int cb_ref;
 
+	bool closed;
+
 	struct s_map_object *next;
 	int next_ref;
 };