From 8cb7dd2fa9566ac24638cc4e8a6f25557a4f88ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Tue, 8 Feb 2022 17:07:49 +0100 Subject: [PATCH] Fix team switch when there is no history in the team (#5943) --- app/queries/servers/team.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/queries/servers/team.ts b/app/queries/servers/team.ts index 118aec0158..04ef31d364 100644 --- a/app/queries/servers/team.ts +++ b/app/queries/servers/team.ts @@ -59,13 +59,15 @@ export const queryNthLastChannelFromTeam = async (database: Database, teamId: st if (teamChannelHistory.channelIds.length > n + 1) { channelId = teamChannelHistory.channelIds[n]; } - } finally { - if (!channelId) { - // No channel history for the team - const channel = await queryDefaultChannelForTeam(database, teamId); - if (channel) { - channelId = channel.id; - } + } catch { + //Do nothing + } + + if (!channelId) { + // No channel history for the team + const channel = await queryDefaultChannelForTeam(database, teamId); + if (channel) { + channelId = channel.id; } }