Skip to content

Commit 7acfacb

Browse files
cjihrigtargos
authored andcommitted
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: #21545 Fixes: #19991 Reviewed-By: Wyatt Preul <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 45fe865 commit 7acfacb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/node_trace_events.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ static std::unordered_set<std::string> categoryGroups;
9595
// Gets a pointer to the category-enabled flags for a tracing category group,
9696
// if tracing is enabled for it.
9797
static const uint8_t* GetCategoryGroupEnabled(const char* category_group) {
98-
if (category_group == nullptr) return nullptr;
99-
100-
return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group);
98+
CHECK_NOT_NULL(category_group);
99+
return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group);
101100
}
102101

103102
static const char* GetCategoryGroup(Environment* env,

0 commit comments

Comments
 (0)