Explorar o código

Fix width & height checking

DarthSim %!s(int64=7) %!d(string=hai) anos
pai
achega
e7e296aa93
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      processing_options.go

+ 2 - 2
processing_options.go

@@ -110,7 +110,7 @@ func applyWidthOption(po *processingOptions, args []string) error {
 		return fmt.Errorf("Invalid width arguments: %v", args)
 	}
 
-	if w, err := strconv.Atoi(args[0]); err == nil || w >= 0 {
+	if w, err := strconv.Atoi(args[0]); err == nil && w >= 0 {
 		po.Width = w
 	} else {
 		return fmt.Errorf("Invalid width: %s", args[0])
@@ -124,7 +124,7 @@ func applyHeightOption(po *processingOptions, args []string) error {
 		return fmt.Errorf("Invalid height arguments: %v", args)
 	}
 
-	if h, err := strconv.Atoi(args[0]); err == nil || po.Height >= 0 {
+	if h, err := strconv.Atoi(args[0]); err == nil && po.Height >= 0 {
 		po.Height = h
 	} else {
 		return fmt.Errorf("Invalid height: %s", args[0])