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
  • Loading branch information
erikjv authored Jan 27, 2025
1 parent 7e67256 commit 39d2284
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 @@ -72,8 +72,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 39d2284

Please sign in to comment.