Skip to content

Commit

Permalink
Fix "s.sources" is not iterable
Browse files Browse the repository at this point in the history
When exploring the project tree, I ran into this error.
  • Loading branch information
tristan957 committed Nov 16, 2023
1 parent 5a103c4 commit b5e870f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/treeview/nodes/targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ export class TargetNode extends BaseNode {
const sources = new Array<string>();
const generated_sources = new Array<string>();
for (const s of this.target.target_sources) {
sources.push(...s.sources);
sources.push(...s.generated_sources);
if (s.sources) sources.push(...s.sources);

if (s.generated_sources) sources.push(...s.generated_sources);
}

const sourceNode = new TargetSourcesRootNode(this.id, path.dirname(this.target.defined_in), sources);
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export interface TargetSource {
language: LanguageID;
compiler: string[];
parameters: string[];
sources: string[];
generated_sources: string[];
sources: string[] | null;
generated_sources: string[] | null;
}

export interface Target {
Expand Down

0 comments on commit b5e870f

Please sign in to comment.