W wroyw Member Licensed User Feb 21, 2017 #1 Hi, I have a own class where I define a variable in Class_Globals : type T1 ( v1 as float , v2 as float ) type T2 (V3 as float , V4 as T1) but if I want change the V4 value like this : V4.V1 = 1 I get an error : java.lang.NullPointerException: Attempt to write to field 'float b4a.example.csv3$_V4.V1' on a null object reference What make I wrong ?
Hi, I have a own class where I define a variable in Class_Globals : type T1 ( v1 as float , v2 as float ) type T2 (V3 as float , V4 as T1) but if I want change the V4 value like this : V4.V1 = 1 I get an error : java.lang.NullPointerException: Attempt to write to field 'float b4a.example.csv3$_V4.V1' on a null object reference What make I wrong ?
W wroyw Member Licensed User Feb 21, 2017 #2 sorry thats right Class_Globals : type T1 ( v1 as float , v2 as float ) type T2 (V3 as float , V4 as T1) public MyVar as T2 and in my code : MyVar.V4.V1 = 1 (V4 = NULL in degugger) Upvote 0
sorry thats right Class_Globals : type T1 ( v1 as float , v2 as float ) type T2 (V3 as float , V4 as T1) public MyVar as T2 and in my code : MyVar.V4.V1 = 1 (V4 = NULL in degugger)
DonManfred Expert Licensed User Longtime User Feb 21, 2017 #3 Did you initialized your customtype? Code: Copy myvar.initialize Upvote 0
W wroyw Member Licensed User Feb 21, 2017 #4 that was my mistake :-( Is it neccessary only for own types or for all valiables Upvote 0
W wroyw Member Licensed User Feb 22, 2017 #7 hmm, now I have another problem ... Class_Globals: Type T1 ( Bool1 as boolean , Bool2 as boolean) Type T2 (Int1 as Int , Bool as T1) Type T3 (Float1 as float , Type2(3) as T2) public MyType as T3 Initialize: MyType.Initialize but now is MyType.Type2(0).T1 = Null ... Upvote 0
hmm, now I have another problem ... Class_Globals: Type T1 ( Bool1 as boolean , Bool2 as boolean) Type T2 (Int1 as Int , Bool as T1) Type T3 (Float1 as float , Type2(3) as T2) public MyType as T3 Initialize: MyType.Initialize but now is MyType.Type2(0).T1 = Null ...
Erel B4X founder Staff member Licensed User Longtime User Feb 22, 2017 #8 Please use [code]code here...[/code] tags when posting code. Upvote 0
W wroyw Member Licensed User Feb 22, 2017 #9 thanks Code: Copy Class_Globals: Type T1 ( Bool1 as boolean , Bool2 as boolean) Type T2 (Int1 as Int , Bool as T1) Type T3 (Float1 as float , Type2(3) as T2) public MyType as T3 Initialize: MyType.Initialize Why is is MyType.Type2(0).T1 = Null ? Last edited: Feb 22, 2017 Upvote 0
thanks Code: Copy Class_Globals: Type T1 ( Bool1 as boolean , Bool2 as boolean) Type T2 (Int1 as Int , Bool as T1) Type T3 (Float1 as float , Type2(3) as T2) public MyType as T3 Initialize: MyType.Initialize Why is is MyType.Type2(0).T1 = Null ?
Erel B4X founder Staff member Licensed User Longtime User Feb 22, 2017 #10 Type2 is an array with 3 uninitialized T2 objects. You need to initialize it: Code: Copy MyType.Type2(0).Initialize I Upvote 0
Type2 is an array with 3 uninitialized T2 objects. You need to initialize it: Code: Copy MyType.Type2(0).Initialize I