1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix crash on file transfer completed

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-07-12 18:05:25 +02:00
parent dc2d7f1085
commit e63153bfa6

View File

@ -240,11 +240,16 @@ void FileTransfertWidget::onFileTransferFinished(ToxFile File)
if (File.direction == ToxFile::RECEIVING)
{
QPixmap preview;
if (preview.loadFromData(File.file->readAll()))
QFile previewFile(File.filePath);
if (previewFile.open(QIODevice::ReadOnly) && previewFile.size() <= 1024*1024*25) // Don't preview big (>25MiB) images
{
if (preview.loadFromData(previewFile.readAll()))
{
preview = preview.scaledToHeight(40);
pic->setPixmap(preview);
}
previewFile.close();
}
}
}