sc/source/core/tool/compiler.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit e85bb2479f0566fd3a4f8e76fddbe3133f51965c
Author: Eike Rathke <er...@redhat.com>
Date:   Wed Oct 12 19:47:44 2016 +0200

    create NoName error token instead of setting error at the token array
    
    ... when handling name token. This can happen when importing BIFF .xls and 
the
    original range is not present in the document. The document is broken, but 
such
    formula can continue to work if the range expression was not actually 
executed,
    for example IF(TRUE(),then_good,else_bad_range) where else_bad_range is 
#NAME?
    error.
    
    (cherry picked from commit d3645961d98ce9f0cfb1ef7f0aba7bf020b90945)
    
    Change-Id: I823ac89115418cf5069b2baf5c5de2c814319ae7
    Reviewed-on: https://gerrit.libreoffice.org/29736
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 5f827b9..679e7f2 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4573,6 +4573,7 @@ ScRangeData* ScCompiler::GetRangeData( const 
FormulaToken& rToken ) const
 
 bool ScCompiler::HandleRange()
 {
+    ScTokenArray* pNew;
     const ScRangeData* pRangeData = GetRangeData( *mpToken);
     if (pRangeData)
     {
@@ -4581,7 +4582,6 @@ bool ScCompiler::HandleRange()
             SetError( errNoName );
         else if (mbJumpCommandReorder)
         {
-            ScTokenArray* pNew;
             // put named formula into parentheses.
             // But only if there aren't any yet, parenthetical
             // ocSep doesn't work, e.g. SUM((...;...))
@@ -4630,7 +4630,15 @@ bool ScCompiler::HandleRange()
         }
     }
     else
-        SetError(errNoName);
+    {
+        // No ScRangeData for an already compiled token can happen in BIFF .xls
+        // import if the original range is not present in the document.
+        pNew = new ScTokenArray;
+        pNew->Add( new FormulaErrorToken( errNoName));
+        PushTokenArray( pNew, true );
+        pNew->Reset();
+        return GetToken();
+    }
     return true;
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to