Prevent fatal error upon accessing the layout CP.

#5877