Invalid folderitem in NSURLMBS.Constructor

What is an invalid folderitem?

2021-05-07 21:31:28 --------------------------
2021-05-07 21:31:28 An error happened:
2021-05-07 21:31:28 Class/Method: folderItemUtils.FileIsOnlyIcloud
2021-05-07 21:31:28 Time: Friday, May 7, 2021 9:31:28 PM Eastern Daylight Time 54383967
2021-05-07 21:31:28 Type of Error: NilObjectException
2021-05-07 21:31:28 Error Number: 0
2021-05-07 21:31:28 Error Message: Invalid folderitem.
2021-05-07 21:31:28 --------------------------
2021-05-07 21:31:28 Stack:
2021-05-07 21:31:28
Sub NSURLMBS.Constructor(FolderItem)
Function folderItemUtils.FileIsOnlyIcloud(extends FolderItem) as boolean
Sub CheckMailExistingPDF.GetListOfFiles(FolderItem)

I’m checking if the file is in iCloud with NSURLMBS. The folderitem I get with a recursive FileListMBS.

Well, this is caused when NSURL internally is nil.
e.g. when folderitem is nil.
or if URLPath or NativePath are not returning a string.

The file directly comes from looping through FileListMBS:

dim theFileList as new FileListMBS(StartFolderitem)
dim FileCount as Integer = theFileList.Count - 1
for currentFile as Integer = 0 to FileCount
  
  dim theFile as FolderItem = theFileList.TrueItem(currentFile)
  if not theFileList.Visible(currentFile) then
    if theFileList.TrueItem(currentFile).FileIsOnlyIcloud then
      globals.theErrorLog.DialogErrorProceed(kErrorCloud.Replace("<<filename>>", theFileList.TrueItem(currentFile).DisplayPathMBS(" » ")))
      globals.StopArchiving = True
      exit for
    end if
  end if
  
  if theFile <> Nil and theFileList.Visible(currentFile) then
    if theFileList.Directory(currentFile) then
      GetListOfFiles theFile
    else
      dim FileEnding as String = theFile.NameExtensionMBS
      if FileEnding = "pdf" then 
        dim theAuthor as String = GetPDFAuthor(theFile)
        MessageIDs.Value(theAuthor) = theAuthor
      end if
    end if
  end if
  
next

The directory should only contain folders and PDFs.

Sorry, but there is no NSURLMBS used there?

Sorry, forgot the method name. FileListMBS calls the method theFileList.TrueItem(currentFile).FileIsOnlyIcloud where NSUrlMBS is called.

Well, I tried here:

Dim f As FolderItem = SpecialFolder.Desktop

Dim l As New FileListMBS(f)

Dim u As Integer = l.Count-1
For i As Integer = 0 To u
  
  Dim it As FolderItem = l.TrueItem(i)
  Dim n As New NSURLMBS(it)
  
  listbox1.AddRow n.absoluteString
Next

Works fine for me. I did make changes for TrueItem in pr6 or pr7, so maybe check again tomorrow and let me know if you have a case to reproduce.

The user has all her files on iCloud. I’ll re-test with the newer version of the plugin in the next days.