registry/session: fix panic in GetRemoteImageLayer

Fixes #7860