[NUI] Fix TCT fail issues by adding null check (#1558)