Fix error when personalDetail is missing in PlayStation Network integration (#148389)

This commit is contained in:
Manu 2025-07-08 10:16:10 +02:00 committed by GitHub
parent a77a071954
commit f58c76c883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -156,9 +156,9 @@ class PlaystationNetworkSensorEntity(
def entity_picture(self) -> str | None: def entity_picture(self) -> str | None:
"""Return the entity picture to use in the frontend, if any.""" """Return the entity picture to use in the frontend, if any."""
if self.entity_description.key is PlaystationNetworkSensor.ONLINE_ID and ( if self.entity_description.key is PlaystationNetworkSensor.ONLINE_ID and (
profile_pictures := self.coordinator.data.profile["personalDetail"].get( profile_pictures := self.coordinator.data.profile.get(
"profilePictures" "personalDetail", {}
) ).get("profilePictures")
): ):
return next( return next(
(pic.get("url") for pic in profile_pictures if pic.get("size") == "xl"), (pic.get("url") for pic in profile_pictures if pic.get("size") == "xl"),