Fix crash when adding workspace spectra to plot.

This crash was caused by checking the types of units when no units
existed yet. We now adopt the new curve's units if we have none of our
own, and check the unit pointers before dereferencing them.

Refs #8828
Merge branch 'bugfix/8828_fix_crash_when_adding_spectra_to_plot' into develop