diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-13 03:11:32 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-13 03:11:32 +0000 |
commit | e8a2bf9b49db0e5052abc4e572dbb8a8e89603c9 (patch) | |
tree | 5b61af4661d9e9ee46486c2b3b65c09c52c9f81b /libs/pbd/whitespace.cc | |
parent | 2dafaad193f12d282076610ed1ebf1f1bf235ced (diff) |
fix egregious programming sloppiness in strip_whitespace_edges
git-svn-id: svn://localhost/ardour2/trunk@1121 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/whitespace.cc')
-rw-r--r-- | libs/pbd/whitespace.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/pbd/whitespace.cc b/libs/pbd/whitespace.cc index e35a8a8c0e..53616133ad 100644 --- a/libs/pbd/whitespace.cc +++ b/libs/pbd/whitespace.cc @@ -11,6 +11,10 @@ strip_whitespace_edges (string& str) len = str.length(); + if (len == 1) { + return; + } + /* strip front */ for (i = 0; i < len; ++i) { @@ -19,12 +23,21 @@ strip_whitespace_edges (string& str) } } + if (i == len) { + /* its all whitespace, not much we can do */ + return; + } + /* strip back */ if (len > 1) { s = i; i = len - 1; + + if (s == i) { + return; + } do { if (isgraph (str[i]) || i == 0) { |