You're dereferencing a pointer and putting it into a reference, making it impossible to check for NULL, which can be returned from State(). Could this ever happen?