summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Views
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-08-08 22:27:07 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-08-08 22:27:07 -0400
commitd813c4e2c8522584beaf1432725b4cdd2cc251b5 (patch)
treedd7ce212182e773d826c955d3e1deaa7cbcdec40 /src/SMAPI.Web/Views
parente376386d250780c50f17c40f82419128b4e7beab (diff)
downloadSMAPI-d813c4e2c8522584beaf1432725b4cdd2cc251b5.tar.gz
SMAPI-d813c4e2c8522584beaf1432725b4cdd2cc251b5.tar.bz2
SMAPI-d813c4e2c8522584beaf1432725b4cdd2cc251b5.zip
fix log parsing for invalid content packs (#860)
Diffstat (limited to 'src/SMAPI.Web/Views')
-rw-r--r--src/SMAPI.Web/Views/LogParser/Index.cshtml27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index 57e26ace..f71c6ac1 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -352,16 +352,31 @@ else if (log?.IsValid == true)
<span class="notice btn txt" v-on:click="toggleContentPacks">toggle content packs in list</span>
}
</caption>
- @foreach (var mod in log.Mods.Where(p => p.Loaded && !p.IsContentPack))
- {
- if (contentPacks == null || !contentPacks.TryGetValue(mod.Name, out LogModInfo[]? contentPackList))
- contentPackList = null;
+ @{
+ var modsWithContentPacks = log.Mods
+ .Where(mod => mod.Loaded && !mod.IsContentPack)
+ .Select(mod => (
+ Mod: mod,
+ ContentPacks: contentPacks?.TryGetValue(mod.Name, out LogModInfo[]? contentPackList) == true ? contentPackList : Array.Empty<LogModInfo>()
+ ))
+ .ToList();
+ if (contentPacks?.TryGetValue("", out LogModInfo[] invalidPacks) == true)
+ {
+ modsWithContentPacks.Add((
+ Mod: new LogModInfo(ModType.CodeMod, "<invalid content packs>", "", "", ""),
+ ContentPacks: invalidPacks
+ ));
+ }
+ }
+
+ @foreach ((LogModInfo mod, LogModInfo[] contentPackList) in modsWithContentPacks)
+ {
<tr v-on:click="toggleMod('@Model.GetSlug(mod.Name)')" class="mod-entry" v-bind:class="{ hidden: !showMods['@Model.GetSlug(mod.Name)'] }">
<td><input type="checkbox" v-bind:checked="showMods['@Model.GetSlug(mod.Name)']" v-bind:class="{ invisible: !anyModsHidden }" /></td>
<td>
<strong v-pre>@mod.Name</strong> @mod.Version
- @if (contentPackList != null)
+ @if (contentPackList.Any())
{
<div v-if="!hideContentPacks" class="content-packs">
@foreach (var contentPack in contentPackList)
@@ -374,7 +389,7 @@ else if (log?.IsValid == true)
</td>
<td>
@mod.Author
- @if (contentPackList != null)
+ @if (contentPackList.Any())
{
<div v-if="!hideContentPacks" class="content-packs">
@foreach (var contentPack in contentPackList)