Skip to content

Commit 03b7f85

Browse files
committed
Fix bug when create type is not provided
1 parent 9ce1d13 commit 03b7f85

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/views/results/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,15 @@ export function initialise(context: vscode.ExtensionContext) {
180180
const statement = statementDetail.statement;
181181

182182
if (statement.type === StatementType.Create || statement.type === StatementType.Alter) {
183-
const refs = statement.getObjectReferences();
184-
const ref = refs[0];
185-
const databaseObj =
186-
statement.type === StatementType.Create && ref.createType.toUpperCase() === `schema`
187-
? ref.object.schema || ``
188-
: ref.object.schema + ref.object.name;
189-
changedCache.add((databaseObj || ``).toUpperCase());
183+
const refs = statement.getObjectReferences();
184+
if (refs.length > 0) {
185+
const ref = refs[0];
186+
const databaseObj =
187+
statement.type === StatementType.Create && ref.createType.toUpperCase() === `schema`
188+
? ref.object.schema || ``
189+
: ref.object.schema + ref.object.name;
190+
changedCache.add((databaseObj || ``).toUpperCase());
191+
}
190192
}
191193

192194
if (statementDetail.content.trim().length > 0) {

0 commit comments

Comments
 (0)