mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-27 06:35:16 +00:00
[lua] Fix reported crash setting nil as user data (fix #4187)
This commit is contained in:
parent
10738b32c3
commit
82375462ae
@ -67,7 +67,7 @@ int UserData_set_text(lua_State* L) {
|
||||
const char* text = lua_tostring(L, 2);
|
||||
auto wud = get_WithUserData<T>(obj);
|
||||
UserData ud = wud->userData();
|
||||
ud.setText(text);
|
||||
ud.setText(text ? std::string(text): std::string());
|
||||
if (spr) {
|
||||
Tx tx;
|
||||
tx(new cmd::SetUserData(wud, ud, static_cast<Doc*>(spr->document())));
|
||||
|
@ -135,3 +135,10 @@ do
|
||||
assert(spr.properties.a == "hi")
|
||||
assert(spr.properties.b == 60)
|
||||
end
|
||||
|
||||
-- Test crash setting nil user data
|
||||
-- https://github.com/aseprite/aseprite/issues/4187
|
||||
do
|
||||
local spr = Sprite(1, 1)
|
||||
spr.data = nil
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user