Skip to content

Commit

Permalink
fix panic in layer icons
Browse files Browse the repository at this point in the history
fixes #36
  • Loading branch information
rszyma committed Nov 12, 2024
1 parent 0eb9e3f commit 2c56ffa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/custom_icons.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,22 @@ func ResolveIcons(configFolder string, cfg *config.Config) LayerIcons {
for m := cfg.Presets.Front(); m != nil; m = m.Next() {
presetName := m.Key
preset := m.Value
presetIcons := icons.presetIcons[presetName]
if presetIcons == nil {
presetIcons = &LayerIconsForPreset{
layerIcons: make(map[string][]byte),
wildcardIcon: nil,
}
icons.presetIcons[presetName] = presetIcons
}
for layerName, unvalidatedIconPath := range preset.LayerIcons {
data, err := readIconInFolder(unvalidatedIconPath, customIconsFolder)
if err != nil {
log.Warnf("Preset '%s' - custom icon file can't be read: %v", presetName, err)
} else if layerName == "*" {
icons.presetIcons[presetName].wildcardIcon = data
presetIcons.wildcardIcon = data
} else {
icons.presetIcons[presetName].layerIcons[layerName] = data
presetIcons.layerIcons[layerName] = data
}
}
}
Expand Down

0 comments on commit 2c56ffa

Please sign in to comment.