Fix crash in apps without emoji.

This commit is contained in:
John Preston 2019-10-17 11:17:47 +04:00
parent f6e10c65f5
commit 414eee35c2

View file

@ -64,6 +64,7 @@ private:
int _size = 0; int _size = 0;
std::vector<QPixmap> _sprites; std::vector<QPixmap> _sprites;
base::binary_guard _generating; base::binary_guard _generating;
bool _unsupported = false;
}; };
@ -772,7 +773,9 @@ bool Instance::cached() const {
} }
void Instance::draw(QPainter &p, EmojiPtr emoji, int x, int y) { void Instance::draw(QPainter &p, EmojiPtr emoji, int x, int y) {
if (Universal && Universal->id() != _id) { if (_unsupported) {
return;
} else if (Universal && Universal->id() != _id) {
generateCache(); generateCache();
} }
const auto sprite = emoji->sprite(); const auto sprite = emoji->sprite();
@ -805,8 +808,12 @@ void Instance::checkUniversalImages() {
_generating = nullptr; _generating = nullptr;
_sprites.clear(); _sprites.clear();
} }
if (!Universal->ensureLoaded() && Universal->id() != 0) { if (!Universal->ensureLoaded()) {
ClearCurrentSetIdSync(); if (Universal->id() != 0) {
ClearCurrentSetIdSync();
} else {
_unsupported = true;
}
} }
} }