about summary refs log tree commit diff
path: root/convert.go
diff options
context:
space:
mode:
Diffstat (limited to 'convert.go')
-rw-r--r--convert.go37
1 files changed, 24 insertions, 13 deletions
diff --git a/convert.go b/convert.go
index 15c3962..8e9f88a 100644
--- a/convert.go
+++ b/convert.go
@@ -48,21 +48,32 @@ func parseLineOne(SplitTLE []string) (LineOne, error) {
 		return LineOne{}, fmt.Errorf("%s: %#v\n%v", "Could not parse the Satellite Number", SplitTLE[1][2:7], err)
 	}
 
-	// Parse the launch year
-	LaunchYear, err := strconv.Atoi(SplitTLE[1][9:11])
-	if err != nil {
-		return LineOne{}, fmt.Errorf("%s: %#v\n%v", "Could not parse the Launch Year", SplitTLE[1][9:11], err)
+	var LaunchYear int
+	var LaunchNumber int
+	var LaunchPiece string
+
+	if SplitTLE[1][9:16] == "       " {
+		LaunchYear = -1
+		LaunchNumber = -1
+		LaunchPiece = ""
+
+	} else {
+		// Parse the launch year
+		LaunchYear, err = strconv.Atoi(SplitTLE[1][9:11])
+		if err != nil {
+			return LineOne{}, fmt.Errorf("%s: %#v\n%v", "Could not parse the Launch Year", SplitTLE[1][9:11], err)
+		}
+
+		// Parse the launch number
+		LaunchNumber, err = strconv.Atoi(SplitTLE[1][11:14])
+		if err != nil {
+			return LineOne{}, fmt.Errorf("%s: %#v\n%v", "Could not parse the Launch Number", SplitTLE[1][11:14], err)
+		}
+
+		// Parse the launch number
+		LaunchPiece = strings.TrimSpace(SplitTLE[1][14:16])
 	}
 
-	// Parse the launch number
-	LaunchNumber, err := strconv.Atoi(SplitTLE[1][11:14])
-	if err != nil {
-		return LineOne{}, fmt.Errorf("%s: %#v\n%v", "Could not parse the Launch Number", SplitTLE[1][11:14], err)
-	}
-
-	// Parse the launch number
-	LaunchPiece := strings.TrimSpace(SplitTLE[1][14:16])
-
 	// Parse the epoch year
 	EpochYear, err := strconv.Atoi(SplitTLE[1][18:20])
 	if err != nil {