diff --git a/public/script.js b/public/script.js index 42700ea8e..ee41d9b48 100644 --- a/public/script.js +++ b/public/script.js @@ -1344,7 +1344,7 @@ async function Generate(type, automatic_trigger, force_name2) { } else { //console.log('Regenerate call detected') var textareaText = ""; - if (chat[chat.length - 1]['is_user']) {//If last message from You + if (chat.length && chat[chat.length - 1]['is_user']) {//If last message from You } else if (type !== "swipe" && !isImpersonate) {