Fix website deserializer

Fix #909
This commit is contained in:
MM20 2024-07-03 22:45:23 +02:00
parent 3331ea024b
commit 35617a6eb4
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -28,11 +28,11 @@ class WebsiteDeserializer: SearchableDeserializer {
val json = JSONObject(serialized)
return WebsiteImpl(
label = json.getString("label"),
faviconUrl = json.getString("favicon").takeIf { it.isNotBlank() },
imageUrl = json.getString("image").takeIf { it.isNotBlank() },
description = json.getString("description").takeIf { it.isNotBlank() },
faviconUrl = json.optString("favicon").takeIf { it.isNotBlank() },
imageUrl = json.optString("image").takeIf { it.isNotBlank() },
description = json.optString("description").takeIf { it.isNotBlank() },
url = json.getString("url"),
color = json.getInt("color").takeIf { it != 0 }
color = json.optInt("color").takeIf { it != 0 }
)
}
}