Make sure path is not null before using