Commit 818cd3afb9c1a6445cbcd9b4b0693fcb02b7cc2b
1 parent
6b6fd4fc
correct GTools whitespace bug for empty strings
Showing
1 changed file
with
4 additions
and
0 deletions
src/GTools.cpp
| @@ -23,6 +23,10 @@ | @@ -23,6 +23,10 @@ | ||
| 23 | ***************************************************************************/ | 23 | ***************************************************************************/ |
| 24 | std::string strip_whitespace(const std::string arg) | 24 | std::string strip_whitespace(const std::string arg) |
| 25 | { | 25 | { |
| 26 | + // Return empty string if argument is empty | ||
| 27 | + if (arg.empty()) | ||
| 28 | + return arg; | ||
| 29 | + | ||
| 26 | // Get start and stop | 30 | // Get start and stop |
| 27 | std::string::size_type start = arg.find_first_not_of(' '); | 31 | std::string::size_type start = arg.find_first_not_of(' '); |
| 28 | std::string::size_type stop = arg.find_last_not_of(' '); | 32 | std::string::size_type stop = arg.find_last_not_of(' '); |