summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@chown.ath.cx>2011-08-16 00:26:16 +0200
committerGrigori Goronzy <greg@chown.ath.cx>2015-07-10 10:42:40 +0200
commitd5091c88d10cbea95f3e45b31a8738d7cd8e3819 (patch)
tree7e31445ca20d2e91cbb7938445c6140ae9167233
parent1fbe520d41d8a92082826b15dbd1cc54a067fa48 (diff)
downloadlibass-d5091c88d10cbea95f3e45b31a8738d7cd8e3819.tar.bz2
libass-d5091c88d10cbea95f3e45b31a8738d7cd8e3819.tar.xz
Fix trimming function
Did not correctly handle empty strings (only whitespace). Whoops.
-rw-r--r--libass/ass_utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libass/ass_utils.c b/libass/ass_utils.c
index 0fc8b2a..40e6533 100644
--- a/libass/ass_utils.c
+++ b/libass/ass_utils.c
@@ -338,7 +338,7 @@ char *trim_space(char *str)
int right = strlen(str) - 1;
while (isspace(str[left])) left++;
- while (isspace(str[right])) right--;
+ while (right > left && isspace(str[right])) right--;
if (left > 0)
for (i = 0; i <= right - left; i++)