fixes possible NullPointerExceptions

fixes possible NullPointerExceptions
e.g. https://jenkins.catrob.at/view/Catroid/job/Catroid-pullrequest-test/724/testReport/