Robert Valentino Well-Known Member Licensed User Longtime User Jul 2, 2014 #1 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: Code: Copy 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 But that line is defined in my process_globals as Code: Copy Private mUsePinPosition As Int Any Help BobVal
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: Code: Copy 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 But that line is defined in my process_globals as Code: Copy Private mUsePinPosition As Int Any Help BobVal
eps Expert Licensed User Longtime User Jul 2, 2014 #2 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'.. Upvote 0
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'..
Robert Valentino Well-Known Member Licensed User Longtime User Jul 2, 2014 #3 Yes, but there is always a FirstTime, I should have included the code above it. Code: Copy 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 Code: Copy 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. BobVal Upvote 0
Yes, but there is always a FirstTime, I should have included the code above it. Code: Copy 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 Code: Copy 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. BobVal
eps Expert Licensed User Longtime User Jul 2, 2014 #4 If you don't assign it a value it will be null. If you want it to always have a value you will need to assign it a value when it gets defined. You always have a Firsttime, but if it isn't the first time it will be false.. and won't execute that code. Upvote 0
If you don't assign it a value it will be null. If you want it to always have a value you will need to assign it a value when it gets defined. You always have a Firsttime, but if it isn't the first time it will be false.. and won't execute that code.
nikolaus Member Licensed User Longtime User Jul 2, 2014 #5 Robert Valentino said: Yes, but there is always a FirstTime, I should have included the code above it. But in any case just to be sure I did a Code: Copy Private mUsePinPosition as Int = 0 Click to expand... Doesn't this have to be Code: Copy Private mUsePinPosition = 0 as Int Upvote 0
Robert Valentino said: Yes, but there is always a FirstTime, I should have included the code above it. But in any case just to be sure I did a Code: Copy Private mUsePinPosition as Int = 0 Click to expand... Doesn't this have to be Code: Copy Private mUsePinPosition = 0 as Int
Reviewnow Active Member Licensed User Longtime User Jul 2, 2014 #6 Private mUsePinPosition as int : mUsePinPosition = 0 Upvote 0
nikolaus Member Licensed User Longtime User Jul 2, 2014 #7 thats legal, as is mine, but I think the OP's version is not and the assignement is simply ignored Upvote 0
Reviewnow Active Member Licensed User Longtime User Jul 3, 2014 #8 Move your assignment to Sub Process_Globals() Then it can be accessed anywhere Upvote 0
Robert Valentino Well-Known Member Licensed User Longtime User Jul 3, 2014 #9 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 Code: Copy Private mSomeVariable as Int = 0 is proper. I do a lot of Code: Copy private mSomeVariable as Boolean = True or Code: Copy private mSomeVarialbe as Boolean = False and always have had them set right Upvote 0
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 Code: Copy Private mSomeVariable as Int = 0 is proper. I do a lot of Code: Copy private mSomeVariable as Boolean = True or Code: Copy private mSomeVarialbe as Boolean = False and always have had them set right
Erel B4X founder Staff member Licensed User Longtime User Jul 3, 2014 #10 The code above is valid. Can you post the full error message from the logs? Upvote 0
Robert Valentino Well-Known Member Licensed User Longtime User Jul 3, 2014 #11 Well I figured out where this was happening: Code: Copy DBCursor.GetString(DEFINE_DB_FieldTags_ImportantDates) 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 Code: Copy 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. Thanks for the help guys. Upvote 0
Well I figured out where this was happening: Code: Copy DBCursor.GetString(DEFINE_DB_FieldTags_ImportantDates) 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 Code: Copy 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. Thanks for the help guys.