summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-23 22:10:38 +0200
committerwm4 <wm4@nowhere>2013-06-25 00:11:54 +0200
commit2cd53d449abacde3e461c0daa15617aca4450eea (patch)
tree1c4a5f1458b7d32859cf6c9ab2c5c55a73fce64e /sub
parent7e033da8923801da5f8ef08f442dd50f172bac7c (diff)
downloadmpv-2cd53d449abacde3e461c0daa15617aca4450eea.tar.bz2
mpv-2cd53d449abacde3e461c0daa15617aca4450eea.tar.xz
sd_ass: fix nonsense
Actually check the newly added text for whitespace, and not the uninitialized buffer after it. Also, if an even is only whitespace, don't add it at all.
Diffstat (limited to 'sub')
-rw-r--r--sub/sd_ass.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index fad323a735..9c51398f33 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -275,8 +275,11 @@ static char *get_text(struct sd *sd, double pts)
if (event->Text) {
int start = b.len;
ass_to_plaintext(&b, event->Text);
- if (!is_whitespace_only(&b.start[b.len], b.len - start))
+ if (is_whitespace_only(&b.start[start], b.len - start)) {
+ b.len = start;
+ } else {
append(&b, '\n');
+ }
}
}
}