Safety null checks for avatars

This commit is contained in:
Andrew Ferrazzutti 2021-06-03 20:08:03 -04:00
parent b06e4532a1
commit 47a0284e81
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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")