Object of type T can't contains another non-static object of same type. If it may be possible, how to find size of that object? Size of pointer to object is always constant on current system.
Check value of currentptr for non-NULL before you can access fields of currentptr (like is_endpoint).