diff --git a/gpt4all-chat/chatgpt.cpp b/gpt4all-chat/chatgpt.cpp index 5d378930..d9f6114e 100644 --- a/gpt4all-chat/chatgpt.cpp +++ b/gpt4all-chat/chatgpt.cpp @@ -134,7 +134,8 @@ void ChatGPT::prompt(const std::string &prompt, qDebug() << "ChatGPT::prompt end network request"; #endif - m_ctx->n_past += 1; + if (m_ctx) + m_ctx->n_past += 1; m_context.append(QString::fromStdString(prompt)); m_context.append(m_currentResponse);