Skip to content

Commit

Permalink
Fixup 2c12d13 (don't try to dereference a nullptr)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Nov 30, 2017
1 parent f17dcd4 commit 238a994
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/game_events/manager_impl.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 238a994

Please sign in to comment.