Skip to content

Commit 4b71b8e

Browse files
authored
Don't throw when chat viewpane's saveState is called before render (microsoft#182778)
Fix microsoft#182767
1 parent 77b45bd commit 4b71b8e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/vs/workbench/contrib/chat/browser/chatViewPane.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,15 @@ export class ChatViewPane extends ViewPane implements IChatViewPane {
134134
}
135135

136136
override saveState(): void {
137-
// Since input history is per-provider, this is handled by a separate service and not the memento here.
138-
// TODO multiple chat views will overwrite each other
139-
this._widget.saveState();
140-
141-
const widgetViewState = this._widget.getViewState();
142-
this.viewState.inputValue = widgetViewState.inputValue;
143-
this.memento.saveMemento();
137+
if (this._widget) {
138+
// Since input history is per-provider, this is handled by a separate service and not the memento here.
139+
// TODO multiple chat views will overwrite each other
140+
this._widget.saveState();
141+
142+
const widgetViewState = this._widget.getViewState();
143+
this.viewState.inputValue = widgetViewState.inputValue;
144+
this.memento.saveMemento();
145+
}
144146

145147
super.saveState();
146148
}

0 commit comments

Comments
 (0)