Skip to content

Commit

Permalink
src: add null check to GetCategoryGroupEnabled()
Browse files Browse the repository at this point in the history
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: #21545
Fixes: #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>
  • Loading branch information
cjihrig authored and targos committed Jun 28, 2018
1 parent 45fe865 commit 7acfacb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/node_trace_events.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7acfacb

Please sign in to comment.