mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Use base::SafeRound instead of std::round.
Previous assertion violations because of NaN from std::round were in video streaming, see commits27d58ba07b
,8f5830d520
. Now the crashes happened in the ConvertScale() call from a background thread when preparing an image from clipboard for sending to a chat.
This commit is contained in:
@@ -64,11 +64,11 @@ PreparedFileThumbnail PrepareFileThumbnail(QImage &&original) {
|
||||
const auto scaledWidth = [&] {
|
||||
return (width > height)
|
||||
? kThumbnailSize
|
||||
: int(std::round(kThumbnailSize * width / float64(height)));
|
||||
: int(base::SafeRound(kThumbnailSize * width / float64(height)));
|
||||
};
|
||||
const auto scaledHeight = [&] {
|
||||
return (width > height)
|
||||
? int(std::round(kThumbnailSize * height / float64(width)))
|
||||
? int(base::SafeRound(kThumbnailSize * height / float64(width)))
|
||||
: kThumbnailSize;
|
||||
};
|
||||
result.image = scaled
|
||||
|
Reference in New Issue
Block a user