Skip to content

Commit

Permalink
support removing all data from tasks.json
Browse files Browse the repository at this point in the history
- When all data are removed from tasks.json, or data in tasks.json is
corrupted, Theia fails to update tasks that have been loaded into the
memory. This pull request fixes this bug.
- fixes #6032

Signed-off-by: Liang Huang <liang.huang@ericsson.com>
  • Loading branch information
Liang Huang authored and elaihau committed Aug 26, 2019
1 parent da3c2eb commit 33cd496
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/task/src/browser/task-configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,15 @@ export class TaskConfigurations implements Disposable {
if (this.rawTaskConfigurations.has(rootFolderUri)) {
this.rawTaskConfigurations.delete(rootFolderUri);
}
const tasks = rawTasks['tasks'].map((t: TaskCustomization | TaskConfiguration) =>
Object.assign(t, { _source: t.source || this.getSourceFolderFromConfigUri(uri) })
);
this.rawTaskConfigurations.set(rootFolderUri, tasks);
return tasks;
if (rawTasks && rawTasks['tasks']) {
const tasks = rawTasks['tasks'].map((t: TaskCustomization | TaskConfiguration) =>
Object.assign(t, { _source: t.source || this.getSourceFolderFromConfigUri(uri) })
);
this.rawTaskConfigurations.set(rootFolderUri, tasks);
return tasks;
} else {
return [];
}
}
} catch (err) {
console.error(`Error(s) reading config file: ${uri}`);
Expand Down

0 comments on commit 33cd496

Please sign in to comment.