fix NPE when mPrimaryColor is null

I also compared to the iOS code where this error was not happening. Seems it snuck in while trying to optimize the if-statement.