From 5b71d39024b474560e74d1baeb5f118236970696 Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Fri, 5 May 2023 09:58:32 -0400 Subject: [PATCH] Don't crash if state has not been set. --- chatllm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatllm.cpp b/chatllm.cpp index 071a7ddb..89917278 100644 --- a/chatllm.cpp +++ b/chatllm.cpp @@ -404,7 +404,7 @@ void ChatLLM::saveState() void ChatLLM::restoreState() { - if (!isModelLoaded()) + if (!isModelLoaded() || m_state.isEmpty()) return; m_llmodel->restoreState(static_cast(reinterpret_cast(m_state.data())));