From d5091c88d10cbea95f3e45b31a8738d7cd8e3819 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Tue, 16 Aug 2011 00:26:16 +0200 Subject: Fix trimming function Did not correctly handle empty strings (only whitespace). Whoops. --- libass/ass_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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++) -- cgit v1.2.3