On Mon Jun 29 14:21:31 2015, barto...@gmx.de wrote:
> Unfortunatly, another NullPointerException surfaces when looking at
> the newly created $a:
> 
> $ perl6-j -e 'class Foo is repr<CStruct> { has int32 $.idontcare; has
> Foo $.bar }; my $a = Foo.new; say $a.bar'
> java.lang.NullPointerException
>   in block <unit> at -e:1

I tried to look at this NPE, but was unable to find a fix. However, here is 
what I suspect -- maybe it is useful for someone else:

I think the NPE happens in
nqp/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CStructInstance.java:95 
(within public SixModelObject get_attribute_boxed) with the following code:

  o = (Object)Structure.newInstance(structClass, ((Pointer)o));

Four lines above 'o' is created with

  Object o = storage.readField(name);

but 'storage.readField(name)' seems to be 'null'. Maybe this is not filled 
properly when the Perl 6 object is created?

Reply via email to