Skip to content

Commit 13f7387

Browse files
rkeithhillTylerLeonhardt
authored andcommitted
Fix error in HtmlContentView.ShowContent when no JS/CSS provided (#1925)
1 parent 6f91a44 commit 13f7387

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/features/CustomViews.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,18 @@ class HtmlContentView extends CustomView {
207207
this.webviewPanel.dispose();
208208
}
209209

210-
let localResourceRoots: vscode.Uri[] = this.htmlContent.javaScriptPaths.map((p) => {
211-
return vscode.Uri.parse(path.dirname(p));
212-
});
213-
localResourceRoots = localResourceRoots.concat(this.htmlContent.styleSheetPaths.map((p) => {
214-
return vscode.Uri.parse(path.dirname(p));
215-
}));
210+
let localResourceRoots: vscode.Uri[] = [];
211+
if (this.htmlContent.javaScriptPaths) {
212+
localResourceRoots = localResourceRoots.concat(this.htmlContent.javaScriptPaths.map((p) => {
213+
return vscode.Uri.parse(path.dirname(p));
214+
}));
215+
}
216+
217+
if (this.htmlContent.styleSheetPaths) {
218+
localResourceRoots = localResourceRoots.concat(this.htmlContent.styleSheetPaths.map((p) => {
219+
return vscode.Uri.parse(path.dirname(p));
220+
}));
221+
}
216222

217223
this.webviewPanel = vscode.window.createWebviewPanel(
218224
this.id,

0 commit comments

Comments
 (0)