mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Fix scrolling through tile entries without tilemap layer selected crashes the program (fix #3712)
This commit is contained in:
parent
733f7ec2c2
commit
b83afb4daa
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2020-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2020-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -190,19 +190,23 @@ void StateWithWheelBehavior::processWheelAction(
|
||||
|
||||
case WheelAction::FgTile: {
|
||||
auto tilesView = ColorBar::instance()->getTilesView();
|
||||
int lastIndex = tilesView->tileset()->size()-1;
|
||||
int newIndex = initialFgTileIndex() + int(dz);
|
||||
newIndex = std::clamp(newIndex, 0, lastIndex);
|
||||
ColorBar::instance()->setFgTile(newIndex);
|
||||
if (tilesView->tileset()) {
|
||||
int lastIndex = tilesView->tileset()->size()-1;
|
||||
int newIndex = initialFgTileIndex() + int(dz);
|
||||
newIndex = std::clamp(newIndex, 0, lastIndex);
|
||||
ColorBar::instance()->setFgTile(newIndex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WheelAction::BgTile: {
|
||||
auto tilesView = ColorBar::instance()->getTilesView();
|
||||
int lastIndex = tilesView->tileset()->size()-1;
|
||||
int newIndex = initialBgTileIndex() + int(dz);
|
||||
newIndex = std::clamp(newIndex, 0, lastIndex);
|
||||
ColorBar::instance()->setBgTile(newIndex);
|
||||
if (tilesView->tileset()) {
|
||||
int lastIndex = tilesView->tileset()->size()-1;
|
||||
int newIndex = initialBgTileIndex() + int(dz);
|
||||
newIndex = std::clamp(newIndex, 0, lastIndex);
|
||||
ColorBar::instance()->setBgTile(newIndex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user