diff options
Diffstat (limited to 'src/profile/browser-process.ts')
| -rw-r--r-- | src/profile/browser-process.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/profile/browser-process.ts b/src/profile/browser-process.ts index 77bc05c..ac31d4d 100644 --- a/src/profile/browser-process.ts +++ b/src/profile/browser-process.ts @@ -373,9 +373,11 @@ export const detectRunningBrowser = async (preferUserDataDir?: string): Promise< : await collectLinux(); if (candidates.length === 0) return { running: false }; - let best = candidates[0] as BrowserCandidate; + const [first, ...rest] = candidates; + if (!first) return { running: false }; + let best = first; let bestRank = rankBrowserCandidate(best, preferUserDataDir); - for (const candidate of candidates.slice(1)) { + for (const candidate of rest) { const rank = rankBrowserCandidate(candidate, preferUserDataDir); if (rank > bestRank) { best = candidate; |
