vcl/ios/source/gdi/salcoretextlayout.cxx |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 8951ef03b9e99ce468d063c2793a724558af27dc
Author: Tor Lillqvist <t...@iki.fi>
Date:   Tue Sep 4 09:40:57 2012 +0300

    Workaround for crash on iOS
    
    Change-Id: I947f7def862d2a238dc609a91d898f03dbd72b84

diff --git a/vcl/ios/source/gdi/salcoretextlayout.cxx 
b/vcl/ios/source/gdi/salcoretextlayout.cxx
index 99151e8..ff6552f 100644
--- a/vcl/ios/source/gdi/salcoretextlayout.cxx
+++ b/vcl/ios/source/gdi/salcoretextlayout.cxx
@@ -421,6 +421,19 @@ bool CoreTextLayout::LayoutText(ImplLayoutArgs& args)
     {
         return false;
     }
+
+    // If the string contains U+FFFD ("REPLACEMENT CHARACTER"), which
+    // happens at least for the ooo80484-1.slk document in
+    // sc_filters_test, the CTTypesetterCreateWithAttributedString()
+    // call below crashes, at least in the iOS simulator. Go figure.
+    // (In that case the string consists of *only* such characters,
+    // but play it safe.
+    for (int i = 0; i < m_chars_count; i++)
+    {
+        if (args.mpStr[args.mnMinCharPos+i] == 0xFFFD)
+            return false;
+    }
+
     /* c0 and c1 are construction objects */
     CFStringRef c0 = CFStringCreateWithCharactersNoCopy( NULL, 
&(args.mpStr[args.mnMinCharPos]), m_chars_count, kCFAllocatorNull );
     if ( !c0 )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to