aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Germain <bnt.germain@gmail.com>2018-11-23 12:12:13 +0100
committerBenoit Germain <bnt.germain@gmail.com>2018-11-23 12:12:13 +0100
commitdf97c3a7dc32c840434cbc80fbf75214bcab4524 (patch)
tree679426185481b1e2479e694000bb88b503486d1f /src
parent5ba2d137142086da5338e1c2afc88927ea16df17 (diff)
downloadlanes-df97c3a7dc32c840434cbc80fbf75214bcab4524.tar.gz
lanes-df97c3a7dc32c840434cbc80fbf75214bcab4524.tar.bz2
lanes-df97c3a7dc32c840434cbc80fbf75214bcab4524.zip
Raise an error instead of crashing when attempting to transfer a non-deep full userdata
Diffstat (limited to 'src')
-rw-r--r--src/tools.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tools.c b/src/tools.c
index d358e96..b00cef5 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -1617,6 +1617,12 @@ static void inter_copy_keyvaluepair( Universe* U, lua_State* L2, uint_t L2_cache
1617 valPath = (char*) alloca( strlen( upName_) + 16 + 5); 1617 valPath = (char*) alloca( strlen( upName_) + 16 + 5);
1618 sprintf( valPath, "%s[U:%p]", upName_, key); 1618 sprintf( valPath, "%s[U:%p]", upName_, key);
1619 } 1619 }
1620 else if( lua_type( L, key_i) == LUA_TBOOLEAN)
1621 {
1622 int key = lua_toboolean( L, key_i);
1623 valPath = (char*) alloca( strlen( upName_) + 7);
1624 sprintf( valPath, "%s[%s]", upName_, key ? "true" : "false");
1625 }
1620 } 1626 }
1621 /* 1627 /*
1622 * Contents of metatables are copied with cache checking; 1628 * Contents of metatables are copied with cache checking;
@@ -1629,7 +1635,7 @@ static void inter_copy_keyvaluepair( Universe* U, lua_State* L2, uint_t L2_cache
1629 } 1635 }
1630 else 1636 else
1631 { 1637 {
1632 luaL_error( L, "Unable to copy over type '%s' (in %s)", luaL_typename( L, val_i), (vt == VT_NORMAL) ? "table" : "metatable"); 1638 luaL_error( L, "Unable to copy %s entry '%s' because of value is of type '%s'", (vt == VT_NORMAL) ? "table" : "metatable", valPath, luaL_typename( L, val_i));
1633 } 1639 }
1634 } 1640 }
1635} 1641}
@@ -1740,6 +1746,7 @@ static bool_t inter_copy_one_( Universe* U, lua_State* L2, uint_t L2_cache_i, lu
1740 if( lua_isnil( L, -1)) 1746 if( lua_isnil( L, -1))
1741 { 1747 {
1742 lua_pop( L, 2); // ... 1748 lua_pop( L, 2); // ...
1749 ret = FALSE;
1743 } 1750 }
1744 else 1751 else
1745 { 1752 {