segfault fix when trying to send something but the history isn't loaded yet, icon and for attached files which are not previewed

This commit is contained in:
Blue 2021-05-11 00:06:40 +03:00
parent ce047db787
commit b7b70bc198
3 changed files with 61 additions and 31 deletions

View file

@ -112,6 +112,8 @@ Shared::Global::Global():
#endif
}
static const QSize defaultIconFileInfoHeight(50, 50);
Shared::Global::FileInfo Shared::Global::getFileInfo(const QString& path)
{
std::map<QString, FileInfo>::const_iterator itr = instance->fileCache.find(path);
@ -131,6 +133,8 @@ Shared::Global::FileInfo Shared::Global::getFileInfo(const QString& path)
p = FileInfo::Preview::picture;
QImage img(path);
size = img.size();
} else {
size = defaultIconFileInfoHeight;
}
itr = instance->fileCache.insert(std::make_pair(path, FileInfo({info.fileName(), size, type, p}))).first;