mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix possible crash in media viewer.
This commit is contained in:
parent
77a019325d
commit
e2a97e2ae9
1 changed files with 12 additions and 13 deletions
|
@ -2442,20 +2442,19 @@ void OverlayWidget::displayDocument(
|
||||||
refreshCaption(item);
|
refreshCaption(item);
|
||||||
|
|
||||||
_docIconRect = QRect((width() - st::mediaviewFileIconSize) / 2, (height() - st::mediaviewFileIconSize) / 2, st::mediaviewFileIconSize, st::mediaviewFileIconSize);
|
_docIconRect = QRect((width() - st::mediaviewFileIconSize) / 2, (height() - st::mediaviewFileIconSize) / 2, st::mediaviewFileIconSize, st::mediaviewFileIconSize);
|
||||||
if (documentBubbleShown()) {
|
int32 colorIndex = documentColorIndex(_document, _docExt);
|
||||||
if (!_document || !_document->hasThumbnail()) {
|
_docIconColor = documentColor(colorIndex);
|
||||||
int32 colorIndex = documentColorIndex(_document, _docExt);
|
const style::icon *(thumbs[]) = { &st::mediaviewFileBlue, &st::mediaviewFileGreen, &st::mediaviewFileRed, &st::mediaviewFileYellow };
|
||||||
_docIconColor = documentColor(colorIndex);
|
_docIcon = thumbs[colorIndex];
|
||||||
const style::icon *(thumbs[]) = { &st::mediaviewFileBlue, &st::mediaviewFileGreen, &st::mediaviewFileRed, &st::mediaviewFileYellow };
|
|
||||||
_docIcon = thumbs[colorIndex];
|
|
||||||
|
|
||||||
int32 extmaxw = (st::mediaviewFileIconSize - st::mediaviewFileExtPadding * 2);
|
int32 extmaxw = (st::mediaviewFileIconSize - st::mediaviewFileExtPadding * 2);
|
||||||
_docExtWidth = st::mediaviewFileExtFont->width(_docExt);
|
_docExtWidth = st::mediaviewFileExtFont->width(_docExt);
|
||||||
if (_docExtWidth > extmaxw) {
|
if (_docExtWidth > extmaxw) {
|
||||||
_docExt = st::mediaviewFileExtFont->elided(_docExt, extmaxw, Qt::ElideMiddle);
|
_docExt = st::mediaviewFileExtFont->elided(_docExt, extmaxw, Qt::ElideMiddle);
|
||||||
_docExtWidth = st::mediaviewFileExtFont->width(_docExt);
|
_docExtWidth = st::mediaviewFileExtFont->width(_docExt);
|
||||||
}
|
}
|
||||||
} else {
|
if (documentBubbleShown()) {
|
||||||
|
if (_document && _document->hasThumbnail()) {
|
||||||
_document->loadThumbnail(fileOrigin());
|
_document->loadThumbnail(fileOrigin());
|
||||||
const auto tw = _documentMedia->thumbnailSize().width();
|
const auto tw = _documentMedia->thumbnailSize().width();
|
||||||
const auto th = _documentMedia->thumbnailSize().height();
|
const auto th = _documentMedia->thumbnailSize().height();
|
||||||
|
|
Loading…
Add table
Reference in a new issue