NPE protect
Adding test and fix tentative :-)