mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-06 06:58:15 +00:00
lua: Fix crash using Selection:deselect() when there is no selection
Fixes https://community.aseprite.org/t/6169
This commit is contained in:
parent
d75c9c443a
commit
6f048d10c5
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -35,11 +35,13 @@ void DeselectMask::onUndo()
|
||||
{
|
||||
Doc* doc = document();
|
||||
|
||||
doc->setMask(m_oldMask.get());
|
||||
doc->setMaskVisible(true);
|
||||
doc->notifySelectionChanged();
|
||||
if (m_oldMask) {
|
||||
doc->setMask(m_oldMask.get());
|
||||
doc->setMaskVisible(true);
|
||||
m_oldMask.reset();
|
||||
}
|
||||
|
||||
m_oldMask.reset();
|
||||
doc->notifySelectionChanged();
|
||||
}
|
||||
|
||||
size_t DeselectMask::onMemSize() const
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2015-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -116,9 +116,11 @@ int Selection_deselect(lua_State* L)
|
||||
Doc* doc = static_cast<Doc*>(sprite->document());
|
||||
ASSERT(doc);
|
||||
|
||||
Tx tx;
|
||||
tx(new cmd::DeselectMask(doc));
|
||||
tx.commit();
|
||||
if (doc->isMaskVisible()) {
|
||||
Tx tx;
|
||||
tx(new cmd::DeselectMask(doc));
|
||||
tx.commit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
auto mask = obj->mask(L);
|
||||
|
Loading…
Reference in New Issue
Block a user