fix(core): handle zero found peers in foundInputPeers

This commit is contained in:
alina 🌸 2024-08-11 15:11:44 +03:00
parent 9e00e8ccca
commit 9aa03853c8
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -54,6 +54,11 @@ export async function findDialogs(client: ITelegramClient, peers: MaybeArray<str
foundIdxToOriginalIdx.set(foundInputPeers.length - 1, i) foundIdxToOriginalIdx.set(foundInputPeers.length - 1, i)
} }
if (foundInputPeers.length === 0) {
// we didn't find anything, we can't even fetch the dialogs
throw new MtPeerNotFoundError(`Could not find dialogs with peers: ${peers.join(', ')}`)
}
const dialogs = await getPeerDialogs(client, foundInputPeers) const dialogs = await getPeerDialogs(client, foundInputPeers)
if (foundInputPeers.length === peers.length) { if (foundInputPeers.length === peers.length) {