Skip to content

Commit

Permalink
Fix template parser to support empty part
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-novotny committed Jul 23, 2020
1 parent d74c867 commit 6679b0e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion resizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ func NewTemplate(template string) *Template {

parts := strings.Split(template, "-")
for _, part := range parts {
if part[0] == 'w' {
if part == "" {
continue
} else if part[0] == 'w' {
width, _ = strconv.ParseFloat(part[1:], 64)
} else if part[0] == 'h' {
height, _ = strconv.ParseFloat(part[1:], 64)
Expand Down

0 comments on commit 6679b0e

Please sign in to comment.