TRUNK-3970: Fix NPE
TRUNK-3970 add a unit test
Merge pull request #350 from LeeBreisacher/TRUNK-3970

TRUNK-3970: Fix NPE