Only call get_last_child() if the node has children

Explain that the behaviour is otherwise undefined, in the comment.
This commit is contained in:
Florent Le Coz
2014-05-15 00:47:20 +02:00
parent 7c7da2cedb
commit df765faab9
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -380,7 +380,7 @@ void XmppComponent::handle_message(const Stanza& stanza)
// We consider this to be true, unless the error condition is
// specified and is not in the kickable_errors set
bool kickable_error = true;
if (error)
if (error && error->has_children())
{
const XmlNode* condition = error->get_last_child();
if (kickable_errors.find(condition->get_name()) == kickable_errors.end())