Skip to content

Commit c4b0c9d

Browse files
committed
-check RequestId property and the value before turning it into a string
1 parent 31cd5ea commit c4b0c9d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Src/StackifyLib/Internal/Logs/LogQueue.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,22 @@ public void QueueLogMessage(Models.LogMsg msg)
201201
if(traceCtxType != null)
202202
{
203203
var traceContextProp = callContextType.GetProperty("TraceContext");
204-
if(traceCtxType != null)
204+
if(traceContextProp != null)
205205
{
206206
var traceFields = traceContextProp.GetValue(null);
207207
if (traceFields != null)
208208
{
209-
msg.TransID = traceCtxType.GetProperty("RequestId").GetValue(traceFields).ToString();
209+
var reqIdProp = traceCtxType.GetProperty("RequestId");
210+
211+
if (reqIdProp != null)
212+
{
213+
var transIDVal = reqIdProp.GetValue(traceFields);
214+
if (transIDVal != null)
215+
{
216+
msg.TransID = transIDVal.ToString();
217+
}
218+
}
219+
210220
}
211221
}
212222
}

0 commit comments

Comments
 (0)