Check for null before access