Ensure the main field exists before trying to compute the path.
Ensure the main field exists before trying to compute the path.

This is because `path.join` expects valid string arguments and throws otherwise.

treshugart/galvatron