From cf6fde478c4ad80e852137c77bf428a77375a3f5 Mon Sep 17 00:00:00 2001 From: Daniel Warner Date: Sat, 8 Mar 2014 18:46:42 +0000 Subject: [PATCH] Check for point_pos == -1 --- libsgp4/Tle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsgp4/Tle.cpp b/libsgp4/Tle.cpp index 6125bce..599d1a9 100644 --- a/libsgp4/Tle.cpp +++ b/libsgp4/Tle.cpp @@ -215,7 +215,7 @@ void Tle::ExtractDouble(const std::string& str, int point_pos, double& val) /* * integer part */ - if (i < str.begin() + point_pos - 1) + if (point_pos >= 0 && i < str.begin() + point_pos - 1) { bool done = false; @@ -251,7 +251,7 @@ void Tle::ExtractDouble(const std::string& str, int point_pos, double& val) /* * decimal point */ - else if (i == str.begin() + point_pos - 1) + else if (point_pos >= 0 && i == str.begin() + point_pos - 1) { if (temp.length() == 0) {