Do not set _is_defined to true if there are no DoFs.

Closes #4330
Merge pull request #4331 from andrsd/is-defined-fix

Do not set _is_defined to true if there are no DoFs.