Fixes issue #30. No more NPE.
Merge pull request #31 from StephG38/master

Fixes issue #30. No more NPE.