DCHECK for nullptrs in EventBaseLocal setter and factory getter
Summary: `getOrCreateFn()` is prone to undefined behavior as it returns `nullptr` reference if factory function returns a `nullptr` or empty `std::shared_ptr<T>`, or if `emplace(evb, nullptr)` is called. This diff adds `DCHECK`s to enforce non-nulls. Note that `getOrCreate()` is not affected as it uses `std::make_shared` under the hood that is guaranteed to have a new object constructed. Differential Revision: D26246552 fbshipit-source-id: b7bc7164841b70fc0889c782438bf96a61857bbd
Showing
Please register or sign in to comment