<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - CRASH in a BASIC macro"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=135457">135457</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CRASH in a BASIC macro
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.1.0.0.alpha0+ Master
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>BASIC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mikekaganski@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>michael.stahl@cib.de
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="http://bugs.documentfoundation.org/attachment.cgi?id=163960" name="attach_163960" title="Some fields to convert to text by macro">attachment 163960</a> <a href="http://bugs.documentfoundation.org/attachment.cgi?id=163960&action=edit" title="Some fields to convert to text by macro">[details]</a></span>
Some fields to convert to text by macro

When the following BASIC code is executed on the attached document, LibreOffice
crashes:

Sub FieldsToText
  fields = ThisComponent.getTextFields.CreateEnumeration
  Dim map()
  While fields.hasMoreElements
    field = fields.nextElement
    ReDim Preserve map(LBound(map) To UBound(map) + 1)
    map(UBound(map)) = Array(field, field.getPresentation(false))
  Wend
  For i = LBound(map) To UBound(map)
    a = map(i)(0).getAnchor
    If Not (a Is Nothing) Then
      map(i)(0).getAnchor.setString(map(i)(1))
    End If
  Next i
End Sub

Tested with Version: 7.1.0.0.alpha0+ (x64)
Build ID: ed3ccdbde9ace7d2e3d67a9cc83a189cfaf1cad9
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL

The crash seems related to undo data.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>