Skip to content

Commit d18a9c0

Browse files
committed
Guard undefined smtp config
1 parent 7919ba1 commit d18a9c0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/components/merge/MailMerge.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,14 @@ const MailMerge = ({ configPath }: MailMergeProps) => {
4545
setRowsCount(rowCount);
4646
setPdfConfig(pdfConf);
4747

48-
const smtpConf: SmtpConfigType = await ipcRenderer.invoke('get-store', {
49-
key: SmtpConfigKey,
50-
});
51-
setFromEmail(smtpConf.user);
52-
setSmtpValid(smtpConf.valid);
48+
const smtpConf: SmtpConfigType | undefined = await ipcRenderer.invoke(
49+
'get-store',
50+
{
51+
key: SmtpConfigKey,
52+
}
53+
);
54+
setFromEmail(smtpConf ? smtpConf.user : '');
55+
setSmtpValid(smtpConf ? smtpConf.valid : false);
5356
};
5457

5558
const handleChangeSubject = (e: any) => {

0 commit comments

Comments
 (0)