mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Replace asserts limiting values directly in Entry::selectedRange()
There are some cases where these asserts failed (mainly in the dithering matrix selection combobox).
This commit is contained in:
parent
60b4524e41
commit
5ae2e444f2
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
@ -195,8 +195,8 @@ Entry::Range Entry::selectedRange() const
|
||||
range.from = std::min(m_caret, m_select);
|
||||
range.to = std::max(m_caret, m_select);
|
||||
|
||||
ASSERT(range.from >= 0 && range.from < int(m_boxes.size()));
|
||||
ASSERT(range.to >= 0 && range.to <= int(m_boxes.size()));
|
||||
range.from = std::clamp(range.from, 0, std::max(0, int(m_boxes.size())-1));
|
||||
range.to = std::clamp(range.to, 0, int(m_boxes.size()));
|
||||
}
|
||||
return range;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user