fix crash when author map contains blank lines - fixes #598

Tue, 18 Feb 2025 18:30:47 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 18 Feb 2025 18:30:47 +0100
changeset 25
b8d6b14c1555
parent 24
2a4e97fc5ce5
child 26
0b3a92df96db

fix crash when author map contains blank lines - fixes #598

src/settings.cpp file | annotate | diff | comparison | revisions
--- a/src/settings.cpp	Wed Feb 05 23:51:33 2025 +0100
+++ b/src/settings.cpp	Tue Feb 18 18:30:47 2025 +0100
@@ -54,8 +54,9 @@
 }
 
 std::string_view trim(const std::string& str) {
-    size_t s = str.find_first_not_of(" \t");
-    size_t l = str.find_last_not_of(" \t") + 1 - s;
+    size_t s = str.find_first_not_of(" \t\r");
+    if (s == std::string::npos) return "";
+    size_t l = str.find_last_not_of(" \t\r") + 1 - s;
     return std::string_view{str}.substr(s, l);
 }
 

mercurial