From 807f8e68f34e8f82bd4b395cd30e35f128f5e4bc Mon Sep 17 00:00:00 2001 From: Karl Burtram Date: Tue, 7 Aug 2018 13:57:59 -0400 Subject: [PATCH] Fix drag-n-drop null ref in OE (#2163) --- .../viewlet/dragAndDropController.ts | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/sql/parts/objectExplorer/viewlet/dragAndDropController.ts b/src/sql/parts/objectExplorer/viewlet/dragAndDropController.ts index d202b42a6d..2676ef17ed 100644 --- a/src/sql/parts/objectExplorer/viewlet/dragAndDropController.ts +++ b/src/sql/parts/objectExplorer/viewlet/dragAndDropController.ts @@ -96,24 +96,24 @@ export class ServerTreeDragAndDrop implements IDragAndDrop { let targetConnectionProfileGroup: ConnectionProfileGroup = this.getTargetGroup(targetElement); const source = data.getData()[0]; - let oldParent: ConnectionProfileGroup = source.getParent(); - const self = this; - if (this.isDropAllowed(targetConnectionProfileGroup, oldParent, source)) { + if (source && source.getParent) { + let oldParent: ConnectionProfileGroup = source.getParent(); + const self = this; + if (this.isDropAllowed(targetConnectionProfileGroup, oldParent, source)) { - if (source instanceof ConnectionProfile) { - // Change group id of profile - this._connectionManagementService.changeGroupIdForConnection(source, targetConnectionProfileGroup.id).then(() => { - TreeUpdateUtils.registeredServerUpdate(tree, self._connectionManagementService, targetConnectionProfileGroup); - }); - } else if (source instanceof ConnectionProfileGroup) { - // Change parent id of group - this._connectionManagementService.changeGroupIdForConnectionGroup(source, targetConnectionProfileGroup).then(() => { - TreeUpdateUtils.registeredServerUpdate(tree, self._connectionManagementService); - }); + if (source instanceof ConnectionProfile) { + // Change group id of profile + this._connectionManagementService.changeGroupIdForConnection(source, targetConnectionProfileGroup.id).then(() => { + TreeUpdateUtils.registeredServerUpdate(tree, self._connectionManagementService, targetConnectionProfileGroup); + }); + } else if (source instanceof ConnectionProfileGroup) { + // Change parent id of group + this._connectionManagementService.changeGroupIdForConnectionGroup(source, targetConnectionProfileGroup).then(() => { + TreeUpdateUtils.registeredServerUpdate(tree, self._connectionManagementService); + }); + } } } - - return; } public dropAbort(tree: ITree, data: IDragAndDropData): void {