Fixup 2c12d1328b (don't try to dereference a nullptr)

This commit is contained in:
Charles Dang 2017-12-01 10:57:57 +11:00
parent f17dcd4195
commit 238a994429

View file

@ -176,8 +176,14 @@ void event_handlers::remove_event_handler(const std::string& id)
// Do this even if the lock failed.
id_map_.erase(find_it);
// Remove handler from other lists.
clean_up_expired_handlers(handler->get_config()["name"]);
// Remove handler from other lists if we got a lock. If we didn't, the handler
// was already from the main list previously, so any other weak_ptrs to it in
// the by-name or with-vars list should already have been dropped. If for some
// reason they haven't, no problem. They don't do anything and will be dropped
// next cleanup.
if(handler) {
clean_up_expired_handlers(handler->get_config()["name"]);
}
}
log_handlers();