mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 09:41:41 -05:00
Crash fix when setting a background image by URL. #3077
When we choose a file from URL we don't get the filename. In background image apply method we test for a theme / palette file extensions. Now we don't crash there, but we still can't set a .tdesktop-theme or .tdesktop-palette file from URL. Who cares :)
This commit is contained in:
parent
d254058690
commit
a5eb5a6ea2
1 changed files with 8 additions and 6 deletions
|
@ -271,18 +271,20 @@ void BackgroundWidget::notifyFileQueryUpdated(const FileDialog::QueryUpdate &upd
|
|||
return;
|
||||
}
|
||||
|
||||
auto filePath = update.filePaths.front();
|
||||
if (filePath.endsWith(qstr(".tdesktop-theme"), Qt::CaseInsensitive)
|
||||
|| filePath.endsWith(qstr(".tdesktop-palette"), Qt::CaseInsensitive)) {
|
||||
Window::Theme::Apply(filePath);
|
||||
return;
|
||||
if (!update.filePaths.isEmpty()) {
|
||||
auto filePath = update.filePaths.front();
|
||||
if (filePath.endsWith(qstr(".tdesktop-theme"), Qt::CaseInsensitive)
|
||||
|| filePath.endsWith(qstr(".tdesktop-palette"), Qt::CaseInsensitive)) {
|
||||
Window::Theme::Apply(filePath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QImage img;
|
||||
if (!update.remoteContent.isEmpty()) {
|
||||
img = App::readImage(update.remoteContent);
|
||||
} else {
|
||||
img = App::readImage(filePath);
|
||||
img = App::readImage(update.filePaths.front());
|
||||
}
|
||||
|
||||
if (img.isNull() || img.width() <= 0 || img.height() <= 0) return;
|
||||
|
|
Loading…
Add table
Reference in a new issue