Skip to content

Commit

Permalink
fix: crash when a network error occurs during resource retrieval (#12045
Browse files Browse the repository at this point in the history
) (#12046)

Co-authored-by: Erik Verbruggen <[email protected]>
  • Loading branch information
DeepDiver1975 and erikjv authored Jan 27, 2025
1 parent b5098f9 commit 7a9d30c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions changelog/unreleased/12045
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Fix crash after resource job fails

When a network error occurs while fetching a resource (e.g. a space
image), no icon is available, and a crash would occur. This is fixed by
returning an empty icon.

https://github.com/owncloud/client/pull/12045
6 changes: 5 additions & 1 deletion src/libsync/networkjobs/resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ void ResourceJob::finished()

QIcon ResourceJob::asIcon() const
{
if (_cacheKey.isEmpty()) {
// This can happen when a network error occurred when retrieving the icon.
return {};
}

// storing the file on disk enables Qt to apply some optimizations (e.g., caching of rendered pixmaps)
Q_ASSERT(!_cacheKey.isEmpty());
return QIcon(_cache->path(_cacheKey));
}

Expand Down

0 comments on commit 7a9d30c

Please sign in to comment.