[lua] Fix layer iteration when some layer name contains just a number (fix #3045)

This commit is contained in:
Joshua Ogunyinka 2021-11-12 00:09:50 +04:00 committed by David Capello
parent a0bea17bc0
commit 12e61d33be

View File

@ -61,7 +61,7 @@ int Layers_index(lua_State* L)
auto obj = get_obj<LayersObj>(L, 1);
// Index by layer name
if (lua_isstring(L, 2)) {
if (lua_type(L, 2) == LUA_TSTRING) {
if (const char* name = lua_tostring(L, 2)) {
for (ObjectId layerId : obj->layers) {
Layer* layer = doc::get<Layer>(layerId);