Safety null checks for avatars
This commit is contained in:
parent
b06e4532a1
commit
47a0284e81
@ -61,7 +61,7 @@ class Stranger:
|
||||
async def get_by_profile(cls, info: 'Participant') -> Optional['Stranger']:
|
||||
q = ("SELECT fake_mid, name, avatar_path, available "
|
||||
"FROM stranger WHERE name=$1 AND avatar_path=$2")
|
||||
row = await cls.db.fetchrow(q, info.name, info.avatar.path)
|
||||
row = await cls.db.fetchrow(q, info.name, info.avatar.path if info.avatar else "")
|
||||
if not row:
|
||||
return None
|
||||
return cls(**row)
|
||||
|
@ -248,7 +248,7 @@ class MautrixController {
|
||||
.find(e => e.innerText == sender.name)
|
||||
if (participantNameElement) {
|
||||
imgElement = participantNameElement.previousElementSibling.firstElementChild
|
||||
sender.id = imgElement.parentElement.parentElement.getAttribute("data-mid")
|
||||
sender.id = imgElement?.parentElement.parentElement.getAttribute("data-mid")
|
||||
}
|
||||
} else {
|
||||
imgElement = element.querySelector(".mdRGT07Img > img")
|
||||
|
Loading…
Reference in New Issue
Block a user