Skip to content

Commit

Permalink
fix: safety check for undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Piccoli committed Dec 9, 2024
1 parent d27d0a6 commit 41365a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/chat-item/chat-prompt-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,14 @@ export class ChatPromptInput {
let codeAttachment = '';
if (this.userPromptHistoryIndex === this.userPromptHistory.length) {
MynahUITabsStore.getInstance().getTabDataStore(this.props.tabId).updateStore({
promptInputText: this.lastUnsentUserPrompt.inputText,
promptInputText: this.lastUnsentUserPrompt.inputText ?? '',
});
codeAttachment = this.lastUnsentUserPrompt.codeAttachment;
codeAttachment = this.lastUnsentUserPrompt.codeAttachment ?? '';
} else {
MynahUITabsStore.getInstance().getTabDataStore(this.props.tabId).updateStore({
promptInputText: this.userPromptHistory[this.userPromptHistoryIndex].inputText,
});
codeAttachment = this.userPromptHistory[this.userPromptHistoryIndex].codeAttachment;
codeAttachment = this.userPromptHistory[this.userPromptHistoryIndex].codeAttachment ?? '';
}
if (codeAttachment.trim().length > 0) {
codeAttachment = codeAttachment
Expand Down

0 comments on commit 41365a3

Please sign in to comment.