From 637ac1e98a720fb7e1ca07d5d72ee8ad0b72d13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20S=C3=A1ez?= Date: Thu, 12 Mar 2015 21:36:50 +0100 Subject: [PATCH] oc-rtf: no color table definition Be able to parse rtf files without color table defined \colortbl --- NEWS | 1 + OpenChange/RTFHandler.m | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 6d01c3ea2..2d7d7ec7a 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ Enhancements - Improve sync speed from Outlook by non-reprocessing already downloaded unread mails Bug fixes + - Fix server side crash parsing rtf without color table - Weekly recurring events created in SOGo web interface are now shown in Outlook - Fix exception modifications import in recurrence series - Sent mails are not longer in Drafts folder using Outlook diff --git a/OpenChange/RTFHandler.m b/OpenChange/RTFHandler.m index 4535626e3..e7be0f14e 100644 --- a/OpenChange/RTFHandler.m +++ b/OpenChange/RTFHandler.m @@ -824,19 +824,19 @@ const unsigned short ansicpg874[256] = { int color_index; char *v; + if (!formattingOptions) continue; + color_index = [[s substringFromIndex: 2] intValue]; - - if (!formattingOptions) - continue; - - if (formattingOptions->color_index >= 0) // && color_index != formattingOptions->color_index) + colorDef = [colorTable colorDefAtIndex: color_index]; + if (!colorDef) continue; + + if (formattingOptions->color_index >= 0) { [_html appendBytes: "" length: 7]; } - - formattingOptions->color_index = color_index; - colorDef = [colorTable colorDefAtIndex: color_index]; - + + formattingOptions->color_index = color_index; + v = malloc(23*sizeof(char)); memset(v, 0, 23); sprintf(v, "", colorDef->red, colorDef->green, colorDef->blue);