Unhandled NilObjectException debug

Hi all,

Sometimes I got Nil Exceptions from my web app, strangely that it does not raise exception every time for the same operation. My impression is that this kind of exception raised in WebDialogs where WebCanvas appears:

Unhandled NilObjectException
Message:

Stack:
RaiseNilObjectException
App.AddLogbook%%oi8i8
LoginContainerControl.LoginContainerControl.CanvasLoginButton_MouseDown%%o<LoginContainerControl.LoginContainerControl>oi8i8o<REALbasic.MouseEvent>
Delegate.IM_Invoke%%oi8i8o<REALbasic.MouseEvent>
AddHandler.Stub.16%%i8i8o<REALbasic.MouseEvent>
WebControl._ExecuteEvent%b%osA1v
WebCanvas._ExecuteEvent%b%osA1v
WebControl.!_ExecuteEvent%b%ssA1v
WebSession._HandleEvent%%oso<_HTTPServer.HTTPRequestContext>
WebSession._HandleRequest%i8%oso<_HTTPServer.HTTPRequestContext>
WebApplication._HandleHTTPRequest%%oo<_HTTPServer.HTTPRequestContext>
_CGIGateway.GatewayRequestThread.Event_Run%%o<_CGIGateway.GatewayRequestThread>

Can someone teach me how to read the above message so I can have hints to solve the problem? Thanks in advance.

The last method called is App.AddLogbook%%oi8i8 (on top of the stack). Most probably some object accessed within that method is Nil.

Thanks Eli, but doesn’t seem anything wrong with the method:

app.AddLogbook(Action as integer, UserNo as integer)

if UserNo > 0 then
  dim rec as new DatabaseRecord
  dim d as new date
  
  rec.IntegerColumn("UserNo") = UserNo
  rec.IntegerColumn("Action") = Action
  rec.DateColumn("ActionTime") = d
  myDB.InsertRecord("LOGBOOK", rec)
  if myDB.Error then
    msgbox ("app.AddLogbook Error: " + myDB.ErrorMessage)
  end if
end if

and not every time exception raise for this same piece of code and same parameters

myDB.InsertRecord("LOGBOOK", rec)

myDB can be Nil (for whatever reason).

Every object not local to a method must be tested in that method for being Nil before accessing it.

Thanks Eli