Blob Blame History Raw
From 4224a7656915b20819d9eb712160565172567a04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 13 Nov 2014 10:22:08 +0000
Subject: [PATCH] valgrind: check return of convertDateTime before using fDate

Change-Id: I8b95e95218beefe19e881c9d055323d0abec49c7
---
 sc/source/filter/xml/xmlcelli.cxx | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 7c2c190..68fb1fe 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -935,14 +935,16 @@ void ScXMLTableRowCellContext::SetAnnotation(const ScAddress& rPos)
     if( pNote )
     {
         double fDate;
-        rXMLImport.GetMM100UnitConverter().convertDateTime( fDate, mxAnnotationData->maCreateDate );
-        SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
-        sal_uInt32 nfIndex = pNumForm->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM );
-        OUString aDate;
-        Color* pColor = 0;
-        Color** ppColor = &pColor;
-        pNumForm->GetOutputString( fDate, nfIndex, aDate, ppColor );
-        pNote->SetDate( aDate );
+        if (rXMLImport.GetMM100UnitConverter().convertDateTime(fDate, mxAnnotationData->maCreateDate))
+        {
+            SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
+            sal_uInt32 nfIndex = pNumForm->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM );
+            OUString aDate;
+            Color* pColor = 0;
+            Color** ppColor = &pColor;
+            pNumForm->GetOutputString( fDate, nfIndex, aDate, ppColor );
+            pNote->SetDate( aDate );
+        }
         pNote->SetAuthor( mxAnnotationData->maAuthor );
     }
 
-- 
1.9.3