Skip to content

Commit

Permalink
Use default values if width and/or height is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dgurney committed Oct 1, 2018
1 parent 035af7e commit 1b1637b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion png.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"time"
)

const version = "1.0.0"
const version = "1.0.1"

var t = time.Now().UnixNano()
var rndseed = rand.NewSource(t)
Expand Down Expand Up @@ -55,6 +55,15 @@ func main() {
amount := flag.Int("a", 1, "Amount of images to generate.")
ver := flag.Bool("v", false, "Show version number and exit.")
flag.Parse()
switch {
case *height == 0 && *width == 0:
*width = 500
*height = 500
case *width == 0:
*width = 500
case *height == 0:
*height = 500
}
if *ver {
fmt.Printf("Random PNG generator v%s by Daniel Gurney\n", version)
return
Expand Down

0 comments on commit 1b1637b

Please sign in to comment.