bindings: Session::set_trigger(): Fix segfault condition.
sr_session_trigger_set(sess, NULL) is a valid thing to do, meaning that any trigger shall be removed from the session. This closes bugs #491 and #496.
This commit is contained in:
parent
9f42e2e6be
commit
e835e8080b
|
@ -1138,7 +1138,11 @@ shared_ptr<Trigger> Session::trigger()
|
|||
|
||||
void Session::set_trigger(shared_ptr<Trigger> trigger)
|
||||
{
|
||||
check(sr_session_trigger_set(_structure, trigger->_structure));
|
||||
if (!trigger)
|
||||
// Set NULL trigger, i.e. remove any trigger from the session.
|
||||
check(sr_session_trigger_set(_structure, NULL));
|
||||
else
|
||||
check(sr_session_trigger_set(_structure, trigger->_structure));
|
||||
_trigger = trigger;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue