Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
fix empty palettes being stored
Browse files Browse the repository at this point in the history
  • Loading branch information
chirpxiv committed Apr 26, 2023
1 parent 67d333e commit 3f66f69
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions PalettePlus/Services/PaletteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,15 @@ public static Palette GetCharaPalette(Character chara, ApplyOrder order = ApplyO

var store = false;
if (!ActivePalettes.TryGetValue(key, out var stored)) {
store = true;
BuildCharaPalette(chara, out stored, out _);
store = persists != null || stored.ShaderParams.Count > 0;
}

Palette result;
switch (order) {
case ApplyOrder.PersistFirst:
result = persists == null ? stored : persists.Add(stored);
break;
case ApplyOrder.StoredFirst:
result = persists == null ? stored : stored.Add(persists);
break;
default:
result = stored;
break;
}

var result = order switch {
ApplyOrder.PersistFirst => persists == null ? stored : persists.Add(stored),
ApplyOrder.StoredFirst => persists == null ? stored : stored.Add(persists),
_ => stored
};

if (store) ActivePalettes[key] = result;

Expand Down

0 comments on commit 3f66f69

Please sign in to comment.