Android Question Audit program randomly stopping


New Member
Hi all,
Recently took over a project which is basically a program for exporting audits, and producing PDF to deliver to customers in an email receipt. The export side of it is working fine and uploading a db3 to the server, and the methods (using palmohttptopdf) to produce the PDF is working fine.
The issue I'm having however is I'm getting very inconsistent cases of the program stopping mid code flow, which becomes more apparent as more audits are entered and thus more PDFs are created which is tested up to around 20 at a time. When I used breakpoints I was finding it would reach the phtmltopdf_Finished sub and randomly stop processing the rest. This has occurred with the same dataset, and it's a bit of a roll of the dice whether it completes or not.
I'm still learning B4A but was hoping that someone would be able to point me in the right direction, I'll leave some code snippets below which shows an outline of the process, thanks.

For i = 0 To pdfList.Size - 1
    If File.Exists(Starter.Provider.SharedFolder & "/" & "html_reports/", "report_checklist_"&pdfList.Get(i)&".pdf") Then
        File.Delete(Starter.Provider.SharedFolder, "report_checklist_"&pdfList.Get(i)&".pdf")
    End If

Log("---- HTML Mark-up Finished ----")   
Log("---- Starting HtmlToPdf ----")
Dim phtmltopdf As PalmoHtmlToPdf
phtmltopdf.ConvertFromString(html, File.DirInternal  & "/" & "html_reports/","Report_checklist_"&func.Get_Any_Field_and_Table("code", "Property", "PropertyRef = "&propref, False)&".pdf")

Sub phtmltopdf_Finished (Success As Boolean)
    If Success Then
        Log("---- " & (pdfSize + 1) & " Out Of " & pdfList.Size & " PDFs Finished! ----")
        ToastMessageShow("---- " & (pdfSize + 1) & " Out Of " & pdfList.Size & " PDFs Finished! ----", False)
        If pdfSize = pdfList.Size - 1 Then
                Msgbox2Async("Confirm?", "Send Email with Audits?", "Yes", "", "No", Null, False)
                Wait For Msgbox_Result (Result As Int)
                If Result = DialogResponse.POSITIVE Then
                End If
            pdfSize = pdfSize + 1
        End If
    End If
End Sub