Skip to content

Commit 2266c40

Browse files
authored
Update CorProfilerCallback.cpp (#37)
1 parent f61a843 commit 2266c40

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

profiler/src/ProfilerEngine/Datadog.Profiler.Native/CorProfilerCallback.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,26 @@ void CorProfilerCallback::SetStackSamplerEnabled(bool enabled)
8989

9090
void CorProfilerCallback::SetAllocationTrackingEnabled(bool enabled)
9191
{
92-
_pClrEventsParser->SetAllocationTrackingEnabled(enabled);
92+
if (_pClrEventsParser)
93+
{
94+
_pClrEventsParser->SetAllocationTrackingEnabled(enabled);
95+
}
96+
else
97+
{
98+
Log::Debug("SetAllocationTrackingEnabled: trying to enable/disable while it was not configured");
99+
}
93100
}
94101

95102
void CorProfilerCallback::SetContentionTrackingEnabled(bool enabled)
96103
{
97-
_pClrEventsParser->SetContentionTrackingEnabled(enabled);
104+
if (_pClrEventsParser)
105+
{
106+
_pClrEventsParser->SetContentionTrackingEnabled(enabled);
107+
}
108+
else
109+
{
110+
Log::Debug("SetContentionTrackingEnabled: trying to enable/disable while it was not configured");
111+
}
98112
}
99113

100114
void CorProfilerCallback::SetExceptionTrackingEnabled(bool enabled)

0 commit comments

Comments
 (0)