P philster Member Licensed User Longtime User Nov 12, 2015 #1 Hi At runtime the following will fail if the string variable (jp_player.time) is NULL.... //BA.debugLineNum = 85;BA.debugLine="If jp_player.time <> \"\" Then"; if ((_jp_player.red_time).equals("") == false) { .....but when stepping through the code in the debugger it does not pick this up and treats it as an empty string "" and doesn't crash. The error I'm referring to is:- java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference Is this a bug? I'm using b4a 5.5.
Hi At runtime the following will fail if the string variable (jp_player.time) is NULL.... //BA.debugLineNum = 85;BA.debugLine="If jp_player.time <> \"\" Then"; if ((_jp_player.red_time).equals("") == false) { .....but when stepping through the code in the debugger it does not pick this up and treats it as an empty string "" and doesn't crash. The error I'm referring to is:- java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference Is this a bug? I'm using b4a 5.5.
Erel B4X founder Staff member Licensed User Longtime User Nov 12, 2015 #2 How is the null assigned to this variable? Upvote 0
P philster Member Licensed User Longtime User Nov 14, 2015 #3 Erel said: How is the null assigned to this variable? Click to expand... I will need to double check this next week but I'm fairly sure it's null on the SQLite database and the variable is populated using a cursor getstring, e.g.:- var = cursor1.getstring("varchar col") Thanks Phil Upvote 0
Erel said: How is the null assigned to this variable? Click to expand... I will need to double check this next week but I'm fairly sure it's null on the SQLite database and the variable is populated using a cursor getstring, e.g.:- var = cursor1.getstring("varchar col") Thanks Phil
Erel B4X founder Staff member Licensed User Longtime User Nov 15, 2015 #4 Change the check to: Code: Copy If jp_player.time <> Null And jp_player.time <> "" Then Upvote 0