FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add some more information for an assertion violation. · Suninus/tdesktop@da1945d · GitHub

Commit da1945d

Browse files
committed
Add some more information for an assertion violation.
1 parent 12252ef commit da1945d

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎Telegram/SourceFiles/storage/storage_media_prepare.cpp‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ For license and copyright information please follow this link:
1414
#include "ui/image/image_prepare.h"
1515
#include "ui/chat/attach/attach_extensions.h"
1616
#include "ui/chat/attach/attach_prepare.h"
17+
#include "core/crash_reports.h"
1718

1819
#include <QtCore/QSemaphore>
1920
#include <QtCore/QMimeData>
@@ -328,10 +329,21 @@ void UpdateImageDetails(PreparedFile &file, int previewWidth) {
328329
: image->data;
329330
Assert(!preview.isNull());
330331
file.shownDimensions = PrepareShownDimensions(preview);
332+
const auto toWidth = std::min(
333+
previewWidth,
334+
style::ConvertScale(preview.width())
335+
) * cIntRetinaFactor();
331336
const auto scaled = preview.scaledToWidth(
332-
(std::min(previewWidth, style::ConvertScale(preview.width()))
333-
* cIntRetinaFactor()),
337+
toWidth,
334338
Qt::SmoothTransformation);
339+
if (scaled.isNull()) {
340+
CrashReports::SetAnnotation("Info", QString("%1x%2:%3*%4->%5;%6x%7"
341+
).arg(preview.width()).arg(preview.height()
342+
).arg(previewWidth).arg(cIntRetinaFactor()
343+
).arg(toWidth
344+
).arg(scaled.width()).arg(scaled.height()));
345+
Unexpected("Scaled is null.");
346+
}
335347
Assert(!scaled.isNull());
336348
file.preview = Images::prepareOpaque(scaled);
337349
Assert(!file.preview.isNull());

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL