fix a bug in handling of directory for new objects

Check against NULL return values for GetDirectory before trying to cd to
that directory.
Sometimes a MUH1D is created with no directory.  In this case we cannot
create a member ErrorBand in the same directory by cd'ing to it.