c.RWLayer: check for nil before use Upstream-commit: ab3ea81376441e93311c94910be78ac42292c496 Component: engine