mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 05:42:32 +00:00
Fix crash trying to move pixels and the current layer is nullptr
This fix was found thanks to a user provided memory dump. We don't know why the layer can be nullptr, but there are some conditions preventing this situation already in other places of the StandbyState::onMouseDown() member function.
This commit is contained in:
parent
dc7eeac2f8
commit
2a582638ec
@ -243,7 +243,7 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
|
|||||||
if (handle != NoHandle) {
|
if (handle != NoHandle) {
|
||||||
int x, y, opacity;
|
int x, y, opacity;
|
||||||
Image* image = location.image(&x, &y, &opacity);
|
Image* image = location.image(&x, &y, &opacity);
|
||||||
if (image) {
|
if (layer && image) {
|
||||||
if (!layer->isWritable()) {
|
if (!layer->isWritable()) {
|
||||||
StatusBar::instance()->showTip(1000,
|
StatusBar::instance()->showTip(1000,
|
||||||
"Layer '%s' is locked", layer->name().c_str());
|
"Layer '%s' is locked", layer->name().c_str());
|
||||||
@ -258,7 +258,7 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move selected pixels
|
// Move selected pixels
|
||||||
if (editor->isInsideSelection() && msg->left()) {
|
if (layer && editor->isInsideSelection() && msg->left()) {
|
||||||
if (!layer->isWritable()) {
|
if (!layer->isWritable()) {
|
||||||
StatusBar::instance()->showTip(1000,
|
StatusBar::instance()->showTip(1000,
|
||||||
"Layer '%s' is locked", layer->name().c_str());
|
"Layer '%s' is locked", layer->name().c_str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user