Android null pointer checks and Xcode build problem fix

Fix of null pointer exceptions in Java on Android
Fix of Xcode build errors
(Sorry for the massive removal of trailing white space)