Skip to content

Commit

Permalink
GetSelectedItem checking for nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfranblanco committed Feb 10, 2024
1 parent e787de1 commit 225c5a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/server/parsedCodeModel/ParsedDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,12 @@ export class ParsedDocument extends ParsedCode implements IParsedExpressionConta
.concat(this.imports)
.concat(this.expressions);

for (const item of allItems) {
selectedItem = item.getSelectedItem(offset);
if (selectedItem !== null) { return selectedItem; }
}
for (const item of allItems) {
if(item === null) { continue; }
selectedItem = item.getSelectedItem(offset);
if (selectedItem !== null) { return selectedItem; }

}
return this;
}
return selectedItem;
Expand Down
1 change: 1 addition & 0 deletions src/server/parsedCodeModel/ParsedFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class ParsedFunction extends ParsedCode implements IParsedExpressionConta
.concat(this.variables)
.concat(this.modifiers);
for (const item of allItems) {
if(item === null) { continue; }
selectedItem = item.getSelectedItem(offset);
if (selectedItem !== null) { return selectedItem; }
}
Expand Down
1 change: 1 addition & 0 deletions src/server/parsedCodeModel/parsedContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export class ParsedContract extends ParsedCode implements IParsedExpressionConta
.concat(this.receiveFunction);

for (const item of allItems) {
if(item === null) { continue; }
selectedItem = item.getSelectedItem(offset);
if (selectedItem !== null) { return selectedItem; }
}
Expand Down

0 comments on commit 225c5a9

Please sign in to comment.