I keep seeing this message in a debug session and cannot figure out what is causing it.
Is there a easy way to determine where this happening?
Sometimes the debugger points me to this line:
B4X:
If FirstTime Then
mFirstTime = True
mUsePinPosition = 0 '<---------------- Points to this line
mGPS.Initialize("GPS")
mGPSCourseEntry = -1
mGPSCourseHole = -1
mGPSCourseList.Initialize
mGPSCourse.Initialize
mGPSParser.Initialize
End If
Is it definitely that line in the code? As you've got an 'If FirstTime' check which precedes it and this could be what is causing you an issue, if you use the variable later on but haven't assigned a value.. as it isn't the 'FirstTime'..
Yes, but there is always a FirstTime, I should have included the code above it.
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("sPlayerScoring")
Activity.Title = "Player Scoring"
If FirstTime Then
Also this is a Int so even if I do not assign it a value, it should not give me a Null Pointer.
But in any case just to be sure I did a
B4X:
Private mUsePinPosition as Int = 0
and am still have that Null Pointer. I believe it is somewhere else and just happens to be sometimes pointing there.
Interesting questions about the assignments. If I cannot do my assignments that way then I have a lot of code to change because I do that all the time all over the place and to my knowledge have never had a problem.
Hopefull Erel will answer if
In the database I am using someone allowed this field to be Null and I assign it to a string variable that did not test for Null (sure wish allowing a Null field in a DB meant an Empty string "" for string types) but this line was inside a Try / Catch
and the catch part
B4X:
Catch
'Log(LastException.Message)
End Try
was just eating up the Exception. Oh well that's what happens when you use OPC (Other peoples code). I guess I will have to look at all this code instead of just using it.