You don`t can use "you.max_z" if the you pointer is NULL, that gives always a crash!

Use a var to become the distance to the wall:
result = c_trace(my.x, nullvector,IGNORE_ME);
result now have the distance to the wall