Fix crash Ctrl+clicking an ill-formed reference layer cel with width/height < 1.0

The width/height of a reference layer cel cannot be < 1.0, but in the
extreme case where this happens, Ctrl+clicking the reference layer
shouldn't crash the program.
master
David Capello 2022-07-20 15:18:49 -03:00
parent 571134c1b4
commit 52b1899e9d
1 changed files with 4 additions and 0 deletions

View File

@ -43,6 +43,8 @@ namespace doc {
}
void setBounds(const gfx::Rect& bounds) {
ASSERT(bounds.w > 0);
ASSERT(bounds.h > 0);
m_bounds = bounds;
if (m_boundsF)
*m_boundsF = gfx::RectF(bounds);
@ -55,6 +57,8 @@ namespace doc {
m_boundsF = std::make_unique<gfx::RectF>(boundsF);
m_bounds = gfx::Rect(boundsF);
if (m_bounds.w <= 0) m_bounds.w = 1;
if (m_bounds.h <= 0) m_bounds.h = 1;
}
const gfx::RectF& boundsF() const {