server: qBittorrent: avoid accessing undefined cookie object

This commit is contained in:
Jesse Chan
2020-12-13 21:46:22 +08:00
parent 71ce340e64
commit 94a77cc1ab
@@ -67,7 +67,7 @@ class QBittorrentClientGatewayService extends ClientGatewayService {
}: Required<AddTorrentByURLOptions>): Promise<void> {
return this.clientRequestManager
.torrentsAddURLs(urls, {
cookie: cookies != null ? Object.values(cookies)[0][0] : undefined,
cookie: cookies != null ? Object.values(cookies)[0]?.[0] : undefined,
savepath: destination,
tags: tags.join(','),
paused: !start,