mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
Check if there is an edit before applying it to the buffer (#170301)
This was throwing an error before if you were writing `undefined` to a property that didn't exist. Fixes #168092
This commit is contained in:
parent
653ee6ddf0
commit
741531e106
|
@ -51,7 +51,7 @@ export class JSONEditingService implements IJSONEditingService {
|
|||
let hasEdits: boolean = false;
|
||||
for (const value of values) {
|
||||
const edit = this.getEdits(model, value)[0];
|
||||
hasEdits = this.applyEditsToBuffer(edit, model);
|
||||
hasEdits = !!edit && this.applyEditsToBuffer(edit, model);
|
||||
}
|
||||
if (hasEdits) {
|
||||
return this.textFileService.save(model.uri);
|
||||
|
|
Loading…
Reference in a new issue