[TIMOB-9819] added null check to prevent the crash

This fixes the crash but gradient won't be applied. nativeView is never set in TiUIView in the case of heavyweight window.

https://jira.appcelerator.org/browse/TIMOB-9819