diff --git a/public/index.html b/public/index.html
index c788252a9..3b6fa0744 100644
--- a/public/index.html
+++ b/public/index.html
@@ -4755,7 +4755,7 @@
name2: name2,
characterId: this_chid,
groupId: selected_group,
- chatId: (this_chid && characters[this_chid].chat),
+ chatId: (this_chid && characters[this_chid] && characters[this_chid].chat),
onlineStatus: online_status,
addOneMessage: addOneMessage,
generate: Generate,