From af0136ef39f3a5f76f92ea2c515ffc4dfa69a284 Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Thu, 30 Mar 2023 09:41:29 -0700 Subject: [PATCH] All: Fixes #7986: Fix OneDrive sync attempting to call method on `null` variable (#7987) --- packages/lib/SyncTargetOneDrive.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/lib/SyncTargetOneDrive.ts b/packages/lib/SyncTargetOneDrive.ts index 295718677f..93f1060419 100644 --- a/packages/lib/SyncTargetOneDrive.ts +++ b/packages/lib/SyncTargetOneDrive.ts @@ -96,12 +96,14 @@ export default class SyncTargetOneDrive extends BaseSyncTarget { let context = Setting.value(`sync.${this.syncTargetId()}.context`); context = context === '' ? null : JSON.parse(context); let accountProperties = context ? context.accountProperties : null; + const api = this.api(); + if (!accountProperties) { - accountProperties = await this.api_.execAccountPropertiesRequest(); + accountProperties = await api.execAccountPropertiesRequest(); context ? context.accountProperties = accountProperties : context = { accountProperties: accountProperties }; Setting.setValue(`sync.${this.syncTargetId()}.context`, JSON.stringify(context)); } - this.api_.setAccountProperties(accountProperties); + api.setAccountProperties(accountProperties); const appDir = await this.api().appDirectory(); // the appDir might contain non-ASCII characters // /[^\u0021-\u00ff]/ is used in Node.js to detect the unescaped characters.