Prevent NULL pointer dereference when rtype was incorrect