Don't crash if state has not been set.

This commit is contained in:
Adam Treat 2023-05-05 09:58:32 -04:00
parent 019f6d0103
commit 5b71d39024

View File

@ -404,7 +404,7 @@ void ChatLLM::saveState()
void ChatLLM::restoreState() void ChatLLM::restoreState()
{ {
if (!isModelLoaded()) if (!isModelLoaded() || m_state.isEmpty())
return; return;
m_llmodel->restoreState(static_cast<const uint8_t*>(reinterpret_cast<void*>(m_state.data()))); m_llmodel->restoreState(static_cast<const uint8_t*>(reinterpret_cast<void*>(m_state.data())));