Skip to content

Commit ed7c6a7

Browse files
committed
fixed segfault by adding _chatLogic->SetChatbotHandle(this)
1 parent e13bf39 commit ed7c6a7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/chatbot.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ ChatBot::ChatBot(ChatBot &&source)
7777
_chatLogic = source._chatLogic;
7878
_rootNode = source._rootNode;
7979
_currentNode = source._currentNode;
80-
80+
_chatLogic->SetChatbotHandle(this);
8181
source._image = nullptr;
8282
source._chatLogic = nullptr;
8383
source._rootNode = nullptr;
@@ -93,9 +93,13 @@ ChatBot &ChatBot::operator=(ChatBot &&source)
9393
_chatLogic = source._chatLogic;
9494
_rootNode = source._rootNode;
9595
_currentNode = source._currentNode;
96+
_chatLogic->SetChatbotHandle(this);
97+
source._image = nullptr;
98+
source._chatLogic = nullptr;
99+
source._rootNode = nullptr;
100+
source._currentNode = nullptr;
96101
return *this;
97102
}
98-
////
99103
//// EOF STUDENT CODE
100104

101105
void ChatBot::ReceiveMessageFromUser(std::string message)

0 commit comments

Comments
 (0)