Fixed RavenDB-2664

Fixed small null ref error reported by users.