NPE: add null checks

add checks on null, otherwise you get simply a closing program if you call for example

```
itemId = nil
pipe.getUnlocalizedName(itemId)
```

perhaps there are more situations to check on null?