diff options
author | cjihrig <cjihrig@gmail.com> | 2018-06-26 17:16:20 +0300 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2018-06-28 18:51:33 +0300 |
commit | 2a875c3c6ffd5e7023d22990a4ba8e90c4cc1307 (patch) | |
tree | fd12e986b278d0cfe93ea108c20d30b9aa020700 /src/node_trace_events.cc | |
parent | 026d279acae0c11d9767f6f5a7b57a945257e53c (diff) |
src: add null check to GetCategoryGroupEnabled()
The input to this function shouldn't be null, and callers are
not equipped to deal with a nullptr return value. Change the
nullptr return to a CHECK_NOT_NULL(). Also fix the indentation
of the function.
PR-URL: https://github.com/nodejs/node/pull/21545
Fixes: https://github.com/nodejs/node/issues/19991
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'src/node_trace_events.cc')
-rw-r--r-- | src/node_trace_events.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index 13a3dbce1b2..985c706dc4a 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -95,9 +95,8 @@ static std::unordered_set<std::string> categoryGroups; // Gets a pointer to the category-enabled flags for a tracing category group, // if tracing is enabled for it. static const uint8_t* GetCategoryGroupEnabled(const char* category_group) { - if (category_group == nullptr) return nullptr; - - return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); + CHECK_NOT_NULL(category_group); + return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); } static const char* GetCategoryGroup(Environment* env, |