diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2015-01-31 16:50:41 +0100 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2015-01-31 16:50:41 +0100 |
commit | 602f5010bc41f71d29695a348d56b6d953865c2f (patch) | |
tree | 2d9f9f4d473aac7868481189365904153a33cd71 | |
parent | 60cdeb2d441a6bf5c55f511f574b2b9dd598fbb8 (diff) |
Access2Base - Bug in Control.RemoveItem
Removing last item of a Listbox produces an "Index out of rande" run-time error
Bug reported in user forum https://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=75008
Change-Id: I4bf790f8fee1f88def580dee7bac708b5620fbed
-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 66705d9d55f6..d150c879ab4c 100644 --- a/wizards/source/access2base/Control.xba +++ b/wizards/source/access2base/Control.xba @@ -690,21 +690,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 |