From 109da4eb492f66bd1e1c6268d3ffd8621955ea03 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Sun, 23 May 2021 12:40:42 +0100 Subject: [PATCH] simgear/environment/metar.cxx: fix use of std::string::rfind(). Need to compare result with std::string::npos, not for -ve. --- simgear/environment/metar.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simgear/environment/metar.cxx b/simgear/environment/metar.cxx index 5b7e740e..cca8c45d 100644 --- a/simgear/environment/metar.cxx +++ b/simgear/environment/metar.cxx @@ -213,7 +213,7 @@ std::ostream& operator << (std::ostream& out, const Tab& t) } auto nl = s.rfind('\n'); - if (nl < 0) nl = 0; + if (nl == std::string::npos) nl = 0; int column = 0; for (auto i = nl+1; i != s.size(); ++i) { if (s[i] == '\t')