Shell: add missing null check. Fixes #1711.
Uses a snapshot of the reference to Master instead of a proxy

so that the master cannot change all of a sudden in the middle of
operations. This fixes a problem where a service which was instantiated
for one specific master continued to run for a different master after a
sudden master switch. Specifically this resulted in misuse of id ranges,
potentially received from a different master than expected.
Merge pull request #1708 from tinwelint/2.0-cement-master

Uses a snapshot of the reference to Master instead of a proxy
Merge pull request #1712 from jotomo/1711

Shell: add missing null check. Fixes #1711.