Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset value to an empty string when undefined or null #165721

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/vs/editor/common/model/textModel.ts
Expand Up @@ -429,9 +429,8 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati

public setValue(value: string | model.ITextSnapshot): void {
this._assertNotDisposed();
if (value === null) {
// There's nothing to do
return;
if (value === null || value === undefined) {
value = '';
felixlheureux marked this conversation as resolved.
Show resolved Hide resolved
}

const { textBuffer, disposable } = createTextBuffer(value, this._options.defaultEOL);
Expand Down