fixed possible NullPointerException
Merge pull request #260 from martinschaef/patch-6

fixed possible NullPointerException