diff --git a/composables/cache.ts b/composables/cache.ts index e52e4a9e..145834a1 100644 --- a/composables/cache.ts +++ b/composables/cache.ts @@ -44,7 +44,7 @@ export function fetchAccountById(id?: string | null): Promise { const uri = currentInstance.value?.uri const promise = useMasto().accounts.fetch(id) .then((r) => { - if (!r.acct.includes('@') && uri) + if (r.acct && !r.acct.includes('@') && uri) r.acct = `${r.acct}@${uri}` cacheAccount(r, server, true) @@ -63,7 +63,7 @@ export async function fetchAccountByHandle(acct: string): Promise { const uri = currentInstance.value?.uri const account = useMasto().accounts.lookup({ acct }) .then((r) => { - if (!r.acct.includes('@') && uri) + if (r.acct && !r.acct.includes('@') && uri) r.acct = `${r.acct}@${uri}` cacheAccount(r, server, true) diff --git a/composables/masto.ts b/composables/masto.ts index c223c750..729c820d 100644 --- a/composables/masto.ts +++ b/composables/masto.ts @@ -41,7 +41,7 @@ export function getShortHandle({ acct }: Account) { } export function getServerName(account: Account) { - if (account.acct.includes('@')) + if (account.acct?.includes('@')) return account.acct.split('@')[1] // We should only lack the server name if we're on the same server as the account return currentInstance.value?.uri || ''