Skip to content

Commit

Permalink
Fixed empty callstack render issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Oct 11, 2024
1 parent 17fb857 commit fb4af4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/BUTR.CrashReport.Bannerlord.Parser/CrashReportParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static IEnumerable<LogSource> ParseLegacyHtmlLogs(string content)
{
case >= 13:
{
return Enumerable.Empty<LogSource>();
return [];
}
default:
{
Expand Down Expand Up @@ -364,8 +364,9 @@ static IList<ModuleSubModuleModel> GetModuleSubModules(IReadOnlyList<string> lin
IsMultiplayer = GetField(lines, "Multiplayer").Equals("true", StringComparison.OrdinalIgnoreCase),
Url = GetField(lines, "Url"),
UpdateInfo = null,
DependencyMetadatas = GetModuleDependencyMetadatas(GetRange(lines, version == 1 ? "Dependency Metadatas" : "Dependencies", new[] { "SubModules", "Additional Assemblies", "Url" })),
SubModules = GetModuleSubModules(GetRange(lines, "SubModules", new[] { "Additional Assemblies" })),
DependencyMetadatas = GetModuleDependencyMetadatas(GetRange(lines, version == 1 ? "Dependency Metadatas" : "Dependencies", ["SubModules", "Additional Assemblies", "Url"
])),
SubModules = GetModuleSubModules(GetRange(lines, "SubModules", ["Additional Assemblies"])),
Capabilities = Array.Empty<CapabilityModuleOrPluginModel>(),
AdditionalMetadata = new List<MetadataModel> { new() { Key = "METADATA:MANAGED_BY_VORTEX", Value = isVortex.ToString() } }.Concat(lines.SkipWhile(l => !l.StartsWith("Additional Assemblies:")).Skip(1).Select(l =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private void InitializeExceptionRecursively()
curr = _crashReport.Exception;
while (curr is not null)
{
var callStackLines = curr.CallStack.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Select(x => x).ToArray();
var callStackLines = curr.CallStack.Split([Environment.NewLine], StringSplitOptions.RemoveEmptyEntries).Select(x => x).ToArray();

var sb = new StringBuilder();
for (var i = 0; i < callStackLines.Length; i++)
Expand All @@ -49,7 +49,7 @@ private void InitializeExceptionRecursively()

_exceptionsUtf8[level] = UnsafeHelper.ToUtf8Array(sb.ToString());

var fistCallstackLine = callStackLines[0].Trim();
var fistCallstackLine = callStackLines.Length > 0 ? callStackLines[0].Trim() : string.Empty;
_stacktracesUtf8[level] = _crashReport.EnhancedStacktrace.FirstOrDefault(x => fistCallstackLine == $"at {x.FrameDescription}");

_callstackLineCount[level] = callStackLines.Length;
Expand Down

0 comments on commit fb4af4d

Please sign in to comment.