www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - "null this"

reply "Mineko" <uminekorox gmail.com> writes:
So, I was doing some coding to my IO.d, and came across the 
strangest error, I looked it up and tried some different asserts, 
which is why it shows up as something different from "null this" 
now, anyway here, I seriously can't figure this out, the code is 
here: http://pastebin.com/bGiKMM4Y

core.exception.AssertError src/breaker/utility/io.d(167): 
(io.d:add) this is null
----------------
bin/Breaker 3D Game Engine(_d_assert_msg+0x45) [0x5130e9]
bin/Breaker 3D Game Engine(void 
breaker.utility.io.IO.add!(immutable(char)[], immutable(char)[], 
immutable(char)[]).add(immutable(bool), immutable(char)[], 
immutable(char)[], immutable(char)[])+0x66) [0x4c355e]
bin/Breaker 3D Game Engine(immutable(char)[] 
breaker.utility.io.getDir(immutable(char[]))+0x1c2) [0x4c17ea]
bin/Breaker 3D Game Engine(breaker.utility.io.IO 
breaker.utility.io.IO.__ctor(immutable(char[]), 
immutable(char[]), immutable(char[]))+0x1cf) [0x4c1e37]
bin/Breaker 3D Game Engine(_Dmain+0x8b) [0x4c75bb]
bin/Breaker 3D Game Engine(void rt.dmain2._d_run_main(int, 
char**, extern (C) int function(char[][])*).runAll().void 
__lambda1()+0x18) [0x514a20]
bin/Breaker 3D Game Engine(void rt.dmain2._d_run_main(int, 
char**, extern (C) int function(char[][])*).tryExec(scope void 
delegate())+0x2a) [0x51497a]
bin/Breaker 3D Game Engine(void rt.dmain2._d_run_main(int, 
char**, extern (C) int function(char[][])*).runAll()+0x30) 
[0x5149e0]
bin/Breaker 3D Game Engine(void rt.dmain2._d_run_main(int, 
char**, extern (C) int function(char[][])*).tryExec(scope void 
delegate())+0x2a) [0x51497a]
bin/Breaker 3D Game Engine(_d_run_main+0x1a3) [0x5148fb]
bin/Breaker 3D Game Engine(main+0x25) [0x4c7d85]
/usr/lib/libc.so.6(__libc_start_main+0xf5) [0x7ff428219bc5]
----------------

Exited: 256

Thank you for your time and help.
Dec 09 2013
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
When you used the class, did you remember to new it?

Unlike C++, "Io io;" in D would be null. You have to create it 
with "io = new Io();"
Dec 09 2013
parent "Mineko" <uminekorox gmail.com> writes:
On Monday, 9 December 2013 at 19:53:09 UTC, Adam D. Ruppe wrote:
 When you used the class, did you remember to new it?

 Unlike C++, "Io io;" in D would be null. You have to create it 
 with "io = new Io();"
You got me thinking in the right direction, turns out I was putting in a bad parameter at the places like Io session ... session = new IO(...) Thank you very much. :)
Dec 09 2013