diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 7e88a2f65ce..a0596eae901 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -1967,7 +1967,10 @@ static int trim_spaces(WCHAR *in, WCHAR *ret) while (isspaceW(*in)) in++; - len = strlenW(in); + ret[0] = 0; + if (!(len = strlenW(in))) + return 0; + while (isspaceW(in[len-1])) len--;