Nil safety check to prevent crash due to a thrown exception.