mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix a possible crash in userpic editor.
This commit is contained in:
parent
dff1568cb2
commit
985db8aacf
1 changed files with 8 additions and 0 deletions
|
@ -104,7 +104,11 @@ void ColorsLine::fillButtons() {
|
||||||
container,
|
container,
|
||||||
st::userpicBuilderEmojiColorMinus));
|
st::userpicBuilderEmojiColorMinus));
|
||||||
_wraps.push_back(minus);
|
_wraps.push_back(minus);
|
||||||
|
minus->toggle(_colors->size() > 1, anim::type::instant);
|
||||||
minus->entity()->setClickedCallback([=] {
|
minus->entity()->setClickedCallback([=] {
|
||||||
|
if (_colors->size() < 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto wasColors = *_colors;
|
const auto wasColors = *_colors;
|
||||||
_colors->erase(_colors->end() - 1);
|
_colors->erase(_colors->end() - 1);
|
||||||
const auto nowColors = *_colors;
|
const auto nowColors = *_colors;
|
||||||
|
@ -148,7 +152,11 @@ void ColorsLine::fillButtons() {
|
||||||
container,
|
container,
|
||||||
st::userpicBuilderEmojiColorPlus));
|
st::userpicBuilderEmojiColorPlus));
|
||||||
_wraps.push_back(plus);
|
_wraps.push_back(plus);
|
||||||
|
plus->toggle(_colors->size() < kMaxColors, anim::type::instant);
|
||||||
plus->entity()->setClickedCallback([=] {
|
plus->entity()->setClickedCallback([=] {
|
||||||
|
if (_colors->size() >= kMaxColors) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto wasColors = *_colors;
|
const auto wasColors = *_colors;
|
||||||
_colors->push_back(RandomColor(_colors->back()));
|
_colors->push_back(RandomColor(_colors->back()));
|
||||||
const auto nowColors = *_colors;
|
const auto nowColors = *_colors;
|
||||||
|
|
Loading…
Add table
Reference in a new issue