fixed bug where empty line would crash program
This commit is contained in:
		
							
								
								
									
										7
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.go
									
									
									
									
									
								
							@@ -71,6 +71,7 @@ func main() {
 | 
				
			|||||||
		}))
 | 
							}))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, upc := range upcs {
 | 
						for _, upc := range upcs {
 | 
				
			||||||
 | 
							if len(upc) > 0 {
 | 
				
			||||||
			checkForNonStartingNumber := regex.MatchString(upc)
 | 
								checkForNonStartingNumber := regex.MatchString(upc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if checkForNonStartingNumber {
 | 
								if checkForNonStartingNumber {
 | 
				
			||||||
@@ -78,7 +79,7 @@ func main() {
 | 
				
			|||||||
				continue
 | 
									continue
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if isNumeric(upc) == true {
 | 
								if isNumeric(upc) {
 | 
				
			||||||
				gtins = append(gtins, upc)
 | 
									gtins = append(gtins, upc)
 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -111,6 +112,10 @@ func main() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			gtins = append(gtins, upc)
 | 
								gtins = append(gtins, upc)
 | 
				
			||||||
			checkBar.Add(1)
 | 
								checkBar.Add(1)
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								gtins = append(gtins, "")
 | 
				
			||||||
 | 
								checkBar.Add(1)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	answerBar := progressbar.NewOptions(len(gtins),
 | 
						answerBar := progressbar.NewOptions(len(gtins),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user