CID-1116298 path can be null, make sure that is properly handled
CID-1116300 Prevent potential NPE