added check to make sure a layout exists before calling pre_render and pre_process hooks when rendering a view page