NULL-proof ScopeGet

This arised when function regarray was calling ScopeGet with a NULL pointer,
resulting in a segfault. We have as a rule agreed that this is an error on
the caller side, but since we are getting close to the release, I don't want
to risk additional segfaults due to careless callers. Either way, ScopeGet is
marked for deprecation.
Merge pull request #708 from sigurdteigen/fix/null-proof-scopeget

NULL-proof ScopeGet