Prevent fatal error upon accessing the layout CP - 3.12.

@rbran100 #5877