Skip to content

Commit

Permalink
Ignore when the overlays folder is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
boppreh committed May 3, 2014
1 parent 2bf7f1a commit 7e5d5df
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions grid.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,17 @@ func loadImage(path string) (img image.Image, err error) {
}
// Loads the overlays from the given dir, returning a map of name -> image.
func LoadOverlays(dir string) (overlays map[string]image.Image, err error) {
overlays = make(map[string]image.Image, 0)

if _, err = os.Stat(dir); err != nil {
return overlays, nil
}

files, err := ioutil.ReadDir(dir)
if err != nil {
return
}

overlays = make(map[string]image.Image, 0)

for _, file := range files {
img, err := loadImage(filepath.Join(dir, file.Name()))
if err != nil {
Expand Down

0 comments on commit 7e5d5df

Please sign in to comment.