server: fix crash when favicon is not available

This commit is contained in:
Bixilon 2021-07-25 18:56:29 +02:00
parent b8adbe8973
commit 4e9e2476f1
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -38,7 +38,10 @@ data class Server(
return
}
field = value
faviconHash?.let { AssetsUtil.deleteAsset(it, true) }
faviconHash?.let {
// ToDo: Check if other server is using favicon
AssetsUtil.deleteAsset(it, true)
}
if (value == null) {
faviconHash = null
return
@ -60,7 +63,12 @@ data class Server(
if (id > nextServerId) {
nextServerId = id + 1
}
faviconHash?.let { favicon = AssetsUtil.readAsset(it, true) }
try {
faviconHash?.let { favicon = AssetsUtil.readAsset(it, true) }
} catch (exception: Exception) {
exception.printStackTrace()
faviconHash = null
}
}