Skip to content

Commit 3605f56

Browse files
committed
Fix bug when config does not exist
1 parent ced51d0 commit 3605f56

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/views/schemaBrowser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ module.exports = class schemaBrowser {
4646
vscode.commands.registerCommand(`vscode-db2i.addSchemaToSchemaBrowser`, async () => {
4747
const config = instance.getConfig();
4848

49-
let schemas = config.databaseBrowserList;
49+
const schemas = config.databaseBrowserList || [];
5050

5151
const newSchema = await vscode.window.showInputBox({
5252
prompt: `Library to add to Database Browser`
5353
});
5454

55-
if (newSchema) {
55+
if (newSchema && !schemas.includes(newSchema.toUpperCase())) {
5656
schemas.push(newSchema.toUpperCase());
5757
await config.set(`databaseBrowserList`, schemas);
5858
this.refresh();
@@ -221,7 +221,7 @@ module.exports = class schemaBrowser {
221221
if (connection) {
222222
const config = instance.getConfig();
223223

224-
const libraries = config.databaseBrowserList;
224+
const libraries = config.databaseBrowserList || [];
225225

226226
for (let library of libraries) {
227227
items.push(new Schema(library));

0 commit comments

Comments
 (0)