Well, First tell us what is
r
? Based on that it would be easier to rectify, if you are making valid use of
FindControl
or not.
If I assume you are making valid use of
FindControl
then you may put a condition to check null as below.
if(r != null && r.FindControl("Name") != null)
{
currentLastName = ((TextBox)r.FindControl("Name")).Text;
}