Only use the directory if it is valid.

Refs #10844
Merge branch 'bugfix/10844_inelastic_reducer_osx' into develop