Arrghhh sorry.
It's the friggin' wordpress editor, it keeps removing < > tags every time I update it.
Do a ctrl+f for "GetComponent" every instance of it should be in the format
gameObject.GetComponent<TypeOfComponentYouNeed>();
so in your instance
RectTransform rt = gameObject.GetComponent<RectTransform>();
should be correct, if it's crashing that's really odd. Make sure it's attached to the correct object and that it actually has the correct UI components attached.
If you have any further issues let me know :)