wizards/source/access2base/UtilProperty.xba |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit cc6f5af10725f16c659d639857eb80b771f44b9c
Author: Jean-Pierre Ledure <j...@ledure.be>
Date:   Sun Jun 11 17:42:11 2017 +0200

    Access2Base - Correct handling of empty arrays in UtilProperty
    
    Avoid runtime error when storing an empty array
    (undocumented API)
    
    Change-Id: I3f8d31300dec365d7028dcd6bd9de2b24b2e0c4c

diff --git a/wizards/source/access2base/UtilProperty.xba 
b/wizards/source/access2base/UtilProperty.xba
index 88c8aa9bc756..e17b10374441 100644
--- a/wizards/source/access2base/UtilProperty.xba
+++ b/wizards/source/access2base/UtilProperty.xba
@@ -217,8 +217,10 @@ Dim cstLF As String
                        Case &lt; vbArray                                       
&apos;  Scalar
                                sResult = sResult &amp; sName &amp; &quot; = 
&quot; &amp; Utils._CStr(vValue, False) &amp; cstLF
                        Case Else                                               
&apos;  Vector or matrix
+                               If uBound(vValue, 1) &lt; 0 Then
+                                       sResult = sResult &amp; sName &amp; 
&quot; = (0)&quot; &amp; cstLF
                                &apos;  1-dimension but vector of vectors must 
also be considered
-                               If VarType(vValue(0)) &gt;= vbArray Then
+                               ElseIf VarType(vValue(0)) &gt;= vbArray Then
                                        sResult = sResult &amp; sName &amp; 
&quot; = (&quot; &amp; UBound(vValue) + 1 &amp; &quot;,&quot; &amp; 
UBound(vValue(0)) + 1 &amp; &quot;)&quot; &amp; cstLF
                                        For j = 0 To UBound(vValue)
                                                sResult = sResult &amp; 
Utils._CStr(vValue(j), False) &amp; cstLF
@@ -263,19 +265,24 @@ Const cstEqualArray = &quot; = (&quot;, cstEqual = &quot; 
= &quot;
                                If InStr(vString(i), cstEqualArray) = lPosition 
+ Len(sName) Then       &apos;  Start array processing
                                        lSearch = lPosition + Len(sName) + 
Len(cstEqualArray) - 1
                                        sDim = Utils._RegexSearch(vString(i), 
&quot;\([0-9]+\)&quot;, lSearch)  &apos;  e.g. (10)
-                                       If sDim &lt;&gt; &quot;&quot; Then
+                                       If sDim = &quot;(0)&quot; Then          
&apos;  Empty array
+                                               iRows = -1
+                                               vValue = Array()
+                                               _SetPropertyValue(vResult, 
sName, vValue)
+                                       ElseIf sDim &lt;&gt; &quot;&quot; Then  
        &apos;  Vector with content
                                                iCols = CInt(Mid(sDim, 2, 
Len(sDim) - 2))
                                                iRows = 0
                                                ReDim vValue(0 To iCols - 1)
-                                       Else
+                                               iArray = 0
+                                       Else                                    
        &apos;  Matrix with content
                                                lSearch = lPosition + 
Len(sName) + Len(cstEqualArray) - 1
                                                sDim = 
Utils._RegexSearch(vString(i), &quot;\([0-9]+,&quot;, lSearch)   &apos;  e.g. 
(10,
                                                iRows = CInt(Mid(sDim, 2, 
Len(sDim) - 2))
                                                sDim = 
Utils._RegexSearch(vString(i), &quot;,[0-9]+\)&quot;, lSearch)   &apos;  e.g. 
,20)
                                                iCols = CInt(Mid(sDim, 2, 
Len(sDim) - 2))
                                                ReDim vValue(0 To iRows - 1)
+                                               iArray = 0
                                        End If
-                                       iArray = 0
                                ElseIf InStr(vString(i), cstEqual) = lPosition 
+ Len(sName) Then
                                        vValue = Utils._CVar(Mid(vString(i), 
Len(sName) + Len(cstEqual) + 1))
                                        _SetPropertyValue(vResult, sName, 
vValue)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to