This has to be the most frustrating class of exception.
I have an app with the following process
- A Toolbar - when the user clicks an item it sets a “command” variable to a particular value (depending on which item)
- it then calls a method with a dispatcher… “SELECT CASE” that calls a method based on then command passed in, this way commands can be executed by various means
- in this particular case the method called does some processing, and calls a method that manages Most Recent Used Files
- If I put a break on the CALL, it stops as expected, if I then tell the debugger to STEP, it bombs with Nil Exception
- HOWEVER… if I put a break on the VERY FIRST line of the method being called… it STILL bombs
How can I find out what the heck is going on when the exception seems to occur between two breakpoints that should be one after the other?
FYI… everything seems to be initialized… and MRUF_Manage is actually successfully called multiple times during App Open (loading recent files from a previous session)
FUNCTION project_save(f as folderitem) // this appears in the log below
<stuff>
MRUF_Manage Project_Path.nativepath /// first break point, and this is last executable statement in method
END FUNCTION
Public Sub MRUF_Manage(filename As String, delete_it As Boolean = false)
#If Not DebugBuild
#pragma DisableBackgroundTasks
#pragma DisableBoundsChecking
#pragma StackOverflowchecking False
#pragma NilObjectChecking False
#EndIf
Dim i As Integer // <---- SECOND BREAK POINT, it bombs BEFORE it gets her
Dim j As Integer
Dim x As Integer
If filename="" Then Exit Sub
//if left(filename,9)="/volumes/" then filename=mid(filename,10(
j=(-1)
'
' if file is already in the list .. move it to the top
'
x=MRU_Files.Ubound
If x>=0 Then
For i=0 To x
If MRU_Files(i)=filename Then
j=i
Exit For
End If
Next i
If j>0 Then
MRU_Files.Remove(j)
Else
If j=0 Then Exit Sub ' already at the top
End If
End If
If Not delete_it Then
MRU_Files.Insert 0,filename
End If
'
End Sub