NIL Exception for no detectable reason

For some yet to be determined reason… making changes in something as mundane as a string literal in one method
causes a totally unrelated and unchanged method to emit a Nil Exception error… when in fact there is (to the best I can tell nothing that would cause this)

When the app starts… there is a window with a button to select a file… this is the code executed

Dim f As FolderItem
// 0=show side  1=New 2=Recent 3=Existing
Select Case index
Case 0 
   <do stuff>
Case 1 // <--------- THIS IS THE INDEX BEING PASSED
   PagePanel1.value=0
   f=getFilePath(Self)  // <---------  SELF IS THE CURRENT WINDOW
   If f<>Nil Then switch_windows
End Select
Public Function getFIlePath(w as window) as FolderItem
  Dim f As FolderItem
  Dim dlg As New OpenDialog
  dlg.ActionButtonCaption = "Select"
  dlg.Title               = "Title Property"
  dlg.PromptText          = "SELECT Project"
  dlg.InitialDirectory   = GetFolderItem(optionPATH,FolderItem.PathTypeNative)
  dlg.Filter             = FileType2
  If w<>Nil Then // <--------------------------- HERE IS WHERE IT BOMBS [w IS equal to SELF from above, per debugger]
    f = dlg.ShowModalWithin(w)
  Else
    f=dlg.ShowModal
  End If
  If f <> Nil Then
    If open_the_project(f) Then 
      optionPATH=f.parent.NativePath
      MRUF_Manage f.NativePath
    End If
  End If
  Return f
End Function

SOMETIMES, if I quit XOJO, restart and reload the project this error mysteriously goes away, then a few days later I will make a totally unrelated change and boom its back again. Note… any changes are in other windows or methods that would never even have been referenced this early in the execution

Edit : commenting these makes no diff

// If w<>Nil Then
//    f = dlg.ShowModalWithin(w)
//  Else
    f=dlg.ShowModal  // <--------------------------- It just moves to here instead
//  End If

macOS Sierra, Xojo2016r4.1

Maybe a few more details?

:smiley:

It is ironic. No? It’s like a nil object exception for details. :slight_smile:

I tried to delete the post, but the forum saw fit to leave a blank… turned out to be a non-issue after all

what was happening is I’d get a Nil exception when I was attempting to do an OpenDialog

Turns out it was a conflict with another app that had a handle on the database the crashing app was using.

Doesn’t explain why the error happened where it did, and why I didn’t get a Database Locked error, but closing the other app solved the problem… and two apps on the same database won’t be an issue in the real world anyways. since the database in question is 100% internal to the 2nd app… and I only had it open in a DB Editor to confirm that things were updated properly

If you want to get rid of a topic once it’s created, I think you can make it private so it simply isn’t visible to the public at large.