mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-15 03:40:35 +00:00
lua: Add error if we specify and invalid tool in app.useTool()
This commit is contained in:
parent
b2df59563b
commit
23f00d87f6
@ -277,9 +277,13 @@ int App_useTool(lua_State* L)
|
||||
tools::Tool* tool = App::instance()->activeToolManager()->activeTool();
|
||||
tools::Ink* ink = tool->getInk(0);
|
||||
type = lua_getfield(L, 1, "tool");
|
||||
if (auto toolArg = get_tool_from_arg(L, -1)) {
|
||||
tool = toolArg;
|
||||
ink = tool->getInk(0);
|
||||
if (type != LUA_TNIL) {
|
||||
if (auto toolArg = get_tool_from_arg(L, -1)) {
|
||||
tool = toolArg;
|
||||
ink = tool->getInk(0);
|
||||
}
|
||||
else
|
||||
return luaL_error(L, "invalid tool specified in app.useTool() function");
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user