I Indy Active Member Licensed User Longtime User Mar 15, 2018 #1 Hi I have declared an variable of type Map within a Type structure; Code: Copy Type Request(WebRequest as String, WebParams As Map) Dim UserRequest as Request Request.WebRequest = "Test" Request.WebParams.Initialize The issue I'm having is on the 2nd line - the Initialize. I get an error; Code: Copy java.lang.NullPointerException: Attempt to invoke virtual method 'void anywheresoftware.b4a.objects.collections.Map.Initialize()' on a null object reference I'm obviously doing something wrong but, not sure what. Is that kind of declaration even permitted? Thanks
Hi I have declared an variable of type Map within a Type structure; Code: Copy Type Request(WebRequest as String, WebParams As Map) Dim UserRequest as Request Request.WebRequest = "Test" Request.WebParams.Initialize The issue I'm having is on the 2nd line - the Initialize. I get an error; Code: Copy java.lang.NullPointerException: Attempt to invoke virtual method 'void anywheresoftware.b4a.objects.collections.Map.Initialize()' on a null object reference I'm obviously doing something wrong but, not sure what. Is that kind of declaration even permitted? Thanks
JordiCP Expert Licensed User Longtime User Mar 15, 2018 #2 Try with Code: Copy Type Request(WebRequest as String, WebParams As Map) Dim UserRequest as Request UserRequest.initialize 'init the variable instance UserRequest.WebRequest = "Test" UserRequest.WebParams.Initialize 'init the field of the variable instance Upvote 0
Try with Code: Copy Type Request(WebRequest as String, WebParams As Map) Dim UserRequest as Request UserRequest.initialize 'init the variable instance UserRequest.WebRequest = "Test" UserRequest.WebParams.Initialize 'init the field of the variable instance
I Indy Active Member Licensed User Longtime User Mar 15, 2018 #3 Hi JordiCP Perfect! That was it! I didn't initialise the object UserRequest. Thank you very much. Upvote 0