check orientation != null before use it