mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
fix: check before destroy callback
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -93,8 +93,7 @@ class Asst:
|
||||
self.__ptr = Asst.__lib.AsstCreate()
|
||||
|
||||
def __del__(self):
|
||||
if self.__callback:
|
||||
Asst.__lib.AsstDestroy(self.__ptr)
|
||||
Asst.__lib.AsstDestroy(self.__ptr)
|
||||
self.__ptr = None
|
||||
|
||||
def set_instance_option(self, option_type: InstanceOptionType, option_value: str):
|
||||
|
||||
Reference in New Issue
Block a user