From f99f41b712be684886c4368ecc448c7e9fd673dc Mon Sep 17 00:00:00 2001 From: chlafreniere Date: Tue, 31 Mar 2020 20:28:09 -0700 Subject: [PATCH] Check for configuration service --- .../services/notebook/browser/models/cell.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/sql/workbench/services/notebook/browser/models/cell.ts b/src/sql/workbench/services/notebook/browser/models/cell.ts index 610bb4a415..09986b7d74 100644 --- a/src/sql/workbench/services/notebook/browser/models/cell.ts +++ b/src/sql/workbench/services/notebook/browser/models/cell.ts @@ -87,13 +87,14 @@ export class CellModel extends Disposable implements ICellModel { // if the fromJson() method was already called and _cellGuid was previously set, don't generate another UUID unnecessarily this._cellGuid = this._cellGuid || generateUuid(); this.createUri(); - this._isCommandExecutionSettingEnabled = this._configurationService.getValue('notebook.allowCommandExecution'); - - this._register(this._configurationService.onDidChangeConfiguration(e => { - if (e.affectsConfiguration('notebook.allowCommandExecution')) { - this._isCommandExecutionSettingEnabled = this._configurationService.getValue('notebook.allowCommandExecution'); - } - })); + if (this._configurationService) { + this._isCommandExecutionSettingEnabled = this._configurationService.getValue('notebook.allowCommandExecution'); + this._register(this._configurationService.onDidChangeConfiguration(e => { + if (e.affectsConfiguration('notebook.allowCommandExecution')) { + this._isCommandExecutionSettingEnabled = this._configurationService.getValue('notebook.allowCommandExecution'); + } + })); + } } public equals(other: ICellModel) {