fix NPE when mPrimaryColor is null, fixes #5

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