Skip to content

Commit

Permalink
Check if there is an edit before applying it to the buffer (microsoft…
Browse files Browse the repository at this point in the history
…#170301)

This was throwing an error before if you were writing `undefined` to a property that didn't exist.

Fixes microsoft#168092
  • Loading branch information
TylerLeonhardt authored Dec 30, 2022
1 parent 653ee6d commit 741531e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 741531e

Please sign in to comment.