Browse Source

Fix width & height checking

DarthSim 6 years ago
parent
commit
e7e296aa93
1 changed files with 2 additions and 2 deletions
  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)
 		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
 		po.Width = w
 	} else {
 	} else {
 		return fmt.Errorf("Invalid width: %s", args[0])
 		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)
 		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
 		po.Height = h
 	} else {
 	} else {
 		return fmt.Errorf("Invalid height: %s", args[0])
 		return fmt.Errorf("Invalid height: %s", args[0])