diff --git a/matrix_puppeteer_line/db/stranger.py b/matrix_puppeteer_line/db/stranger.py index 72e9e06..5de8a2e 100644 --- a/matrix_puppeteer_line/db/stranger.py +++ b/matrix_puppeteer_line/db/stranger.py @@ -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) diff --git a/puppet/src/contentscript.js b/puppet/src/contentscript.js index e6bd6e9..b73a34a 100644 --- a/puppet/src/contentscript.js +++ b/puppet/src/contentscript.js @@ -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")