fix: check before destroy callback

This commit is contained in:
dantmnf
2024-06-11 23:42:17 +08:00
parent 33bca2e82a
commit 1b2cc439f2
2 changed files with 4 additions and 3 deletions

View File

@@ -101,7 +101,9 @@ Assistant::~Assistant()
if (m_msg_thread.joinable()) {
m_msg_thread.join();
}
m_callback(static_cast<AsstMsgId>(AsstMsg::Destroyed), "{}", m_callback_arg);
if (m_callback) {
m_callback(static_cast<AsstMsgId>(AsstMsg::Destroyed), "{}", m_callback_arg);
}
}
bool asst::Assistant::set_instance_option(InstanceOptionKey key, const std::string& value)