Make sure folder is non-null before appending to it.