Skip to content

Commit 542094d

Browse files
committed
ignore when invalid credentials data is passed
1 parent 5de8ed6 commit 542094d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/vs/code/browser/workbench/workbench.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,13 @@ class WindowIndicator implements IWindowIndicator {
440440
// Find credentials from DOM
441441
const credentialsElement = document.getElementById('vscode-workbench-credentials');
442442
const credentialsElementAttribute = credentialsElement ? credentialsElement.getAttribute('data-settings') : undefined;
443-
const credentialsProvider = new LocalStorageCredentialsProvider(credentialsElementAttribute ? JSON.parse(credentialsElementAttribute) : []);
443+
let credentials = undefined;
444+
if (credentialsElementAttribute) {
445+
try {
446+
credentials = JSON.parse(credentialsElementAttribute);
447+
} catch (error) { /* Invalid credentials are passed. Ignore. */ }
448+
}
449+
const credentialsProvider = new LocalStorageCredentialsProvider(credentials || []);
444450

445451
// Finally create workbench
446452
create(document.body, {

0 commit comments

Comments
 (0)