diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2015-02-01 15:19:08 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-02-06 13:13:40 +0100 |
commit | 4c63a2fe915063857f00062bd86d059035a9a156 (patch) | |
tree | 3317e23fbbe386f69718ce626fced9fd7a7b27f0 | |
parent | 9d2e221e9281ce52c20469baec15bff8c674c282 (diff) |
Access2Base - Patch#2 Bug in Control.RemoveItem
Removing last item of a Listbox produces an "Index out of range" run-time error
Bug reported in user forum https://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=75008
Change-Id: I713e7b6c29286c3774652a9a06c9392fdbe858fd
Reviewed-on: https://gerrit.libreoffice.org/14271
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
-rw-r--r-- | wizards/source/access2base/Control.xba | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/wizards/source/access2base/Control.xba b/wizards/source/access2base/Control.xba index 7e15a1d6800c..057573240028 100644 --- a/wizards/source/access2base/Control.xba +++ b/wizards/source/access2base/Control.xba @@ -682,21 +682,24 @@ Dim vRowSource() As Variant, iCount As Integer, i As Integer, j As integer, bFou For j = i To iCount - 1 vRowSource(j) = vRowSource(j + 1) Next j - ReDim Preserve vRowSource(0 To iCount - 1) bFound = True Exit For ' Remove only 1st occurrence of string End If Next i Case Else If pvIndex < 0 Or pvIndex > iCount Then Goto Error_Index - bFound = True For i = pvIndex To iCount - 1 vRowSource(i) = vRowSource(i + 1) Next i - ReDim Preserve vRowSource(0 To iCount - 1) + bFound = True End Select If bFound Then + If iCount > 0 Then ' https://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=75008 + ReDim Preserve vRowSource(0 To iCount - 1) + Else + vRowSource = Array() + End If If _ParentType <> CTLPARENTISDIALOG Then ControlModel.ListSource = vRowSource() End If |