diff --git a/src/vs/workbench/parts/html/browser/webview.ts b/src/vs/workbench/parts/html/browser/webview.ts
index 00617927f0ce5..43d4a6563d8a4 100644
--- a/src/vs/workbench/parts/html/browser/webview.ts
+++ b/src/vs/workbench/parts/html/browser/webview.ts
@@ -103,7 +103,10 @@ export default class Webview {
this._onDidClickLink.dispose();
this._onDidLoadContent.dispose();
this._disposables = dispose(this._disposables);
- this._webview.parentElement.removeChild(this._webview);
+
+ if (this._webview.parentElement) {
+ this._webview.parentElement.removeChild(this._webview);
+ }
}
get onDidClickLink(): Event {