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;
std::vector<QPixmap> _sprites;
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) {
if (Universal && Universal->id() != _id) {
if (_unsupported) {
return;
} else if (Universal && Universal->id() != _id) {
generateCache();
}
const auto sprite = emoji->sprite();
@ -805,8 +808,12 @@ void Instance::checkUniversalImages() {
_generating = nullptr;
_sprites.clear();
}
if (!Universal->ensureLoaded() && Universal->id() != 0) {
ClearCurrentSetIdSync();
if (!Universal->ensureLoaded()) {
if (Universal->id() != 0) {
ClearCurrentSetIdSync();
} else {
_unsupported = true;
}
}
}