diff --git a/src/AppInstallerCommonCore/AppInstallerTelemetry.cpp b/src/AppInstallerCommonCore/AppInstallerTelemetry.cpp index bec0fea927..84db731141 100644 --- a/src/AppInstallerCommonCore/AppInstallerTelemetry.cpp +++ b/src/AppInstallerCommonCore/AppInstallerTelemetry.cpp @@ -219,10 +219,10 @@ namespace AppInstaller::Logging m_summary.FailureHResult = failure.hr; m_summary.FailureMessage = anonMessage; - m_summary.FailureModule = failure.pszModule; + m_summary.FailureModule = StringOrEmptyIfNull(failure.pszModule); m_summary.FailureThreadId = failure.threadId; m_summary.FailureType = ConvertWilFailureTypeToFailureType(failure.type); - m_summary.FailureFile = failure.pszFile; + m_summary.FailureFile = StringOrEmptyIfNull(failure.pszFile); m_summary.FailureLine = failure.uLineNumber; } diff --git a/src/AppInstallerCommonCore/Public/AppInstallerStrings.h b/src/AppInstallerCommonCore/Public/AppInstallerStrings.h index 8806a92280..01b44f9f9e 100644 --- a/src/AppInstallerCommonCore/Public/AppInstallerStrings.h +++ b/src/AppInstallerCommonCore/Public/AppInstallerStrings.h @@ -177,4 +177,17 @@ namespace AppInstaller::Utility { return ConvertContainerToString(container, [](const auto& item) { return item; }); } + + template + std::basic_string StringOrEmptyIfNull(const CharType* string) + { + if (string) + { + return { string }; + } + else + { + return {}; + } + } }