Skip to content

Commit ce17d1e

Browse files
garyprettyStevenic
andauthored
Add null check for from (#1807)
Co-authored-by: Steven Ickman <stevenic@microsoft.com>
1 parent 4f5fd84 commit ce17d1e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libraries/botbuilder-core/src/telemetryLoggerMiddleware.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export class TelemetryLoggerMiddleware implements Middleware {
188188
protected async fillReceiveEventProperties(activity: Activity, telemetryProperties?: {[key: string]:string}): Promise<{ [key: string]: string }> {
189189
const properties: { [key: string]: string } = {};
190190

191-
properties[this.telemetryConstants.fromIdProperty] = activity.from.id || '';
191+
properties[this.telemetryConstants.fromIdProperty] = activity.from ? activity.from.id : '';
192192
properties[this.telemetryConstants.conversationNameProperty] = activity.conversation.name || '';
193193
properties[this.telemetryConstants.localeProperty] = activity.locale || '';
194194
properties[this.telemetryConstants.recipientIdProperty] = activity.recipient.id;
@@ -197,8 +197,8 @@ export class TelemetryLoggerMiddleware implements Middleware {
197197
// Use the LogPersonalInformation flag to toggle logging PII data, text and user name are common examples
198198
if (this.logPersonalInformation) {
199199

200-
if (activity.from.name && activity.from.name.trim()) {
201-
properties[this.telemetryConstants.fromNameProperty] = activity.from.name;
200+
if (activity.from && activity.from.name && activity.from.name.trim()) {
201+
properties[this.telemetryConstants.fromNameProperty] = activity.from ? activity.from.name : '';;
202202
}
203203

204204
if (activity.text && activity.text.trim()) {

0 commit comments

Comments
 (0)