Skip to content

Commit

Permalink
check nil
Browse files Browse the repository at this point in the history
  • Loading branch information
sayem314 committed Sep 27, 2024
1 parent 850b629 commit 7215ebe
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions utils/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ type SaveLayoutProps struct {
func SaveLayout(props SaveLayoutProps) string {
logger.Debug("Starting save layout formatting for path: %s", props.Path)

// Ensure Track and Album are not nil
if props.Track == nil {
props.Track = make(map[string]interface{})
}
if props.Album == nil {
props.Album = make(map[string]interface{})
}

// Clone album info to avoid modifying the original map
albumInfo := make(map[string]interface{})
for k, v := range props.Album {
Expand Down

0 comments on commit 7215ebe

Please sign in to comment.