Skip to content

Commit 1f32ba9

Browse files
authored
Fix possible NPE when opening chat editor (#278867)
Fix #278790
1 parent 8ca062e commit 1f32ba9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ export class ChatSessionTracker extends Disposable {
4949
return;
5050
}
5151

52-
const editor = e.editor as ChatEditorInput;
52+
const editor = e.editor;
5353
const sessionType = editor.getSessionType();
5454

55-
const model = this.chatService.getSession(editor.sessionResource!);
55+
const model = editor.sessionResource && this.chatService.getSession(editor.sessionResource);
5656
if (model) {
5757
this.chatSessionsService.registerModelProgressListener(model, () => {
5858
this.chatSessionsService.notifySessionItemsChanged(sessionType);

src/vs/workbench/contrib/chat/browser/chatSessions/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type ChatSessionItemWithProvider = IChatSessionItem & {
2525
hideRelativeTime?: boolean;
2626
};
2727

28-
export function isChatSession(schemes: readonly string[], editor?: EditorInput): boolean {
28+
export function isChatSession(schemes: readonly string[], editor?: EditorInput): editor is ChatEditorInput {
2929
if (!(editor instanceof ChatEditorInput)) {
3030
return false;
3131
}

0 commit comments

Comments
 (0)