Messed up the null check by not using the local variable afterwards.