Skip to content

Commit d4d32e1

Browse files
authored
Renderer.renderLayout throws "LayoutNotFoundException" when called with an empty layout (regression vs 7.x)
Any caller that produces an empty cbox_currentLayout (e.g. event.setLayout("") for JSON endpoints, AJAX handlers, or nolayout-style flows) crashes during render with: The layout [] was not found in the module path: /<appMapping>/layouts/
1 parent 2de614c commit d4d32e1

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

system/web/Renderer.cfc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -605,20 +605,20 @@ component
605605
}
606606
}
607607

608-
// Discover the layout location + helpers
609-
var layoutLocations = discoverViewPaths(
610-
view : cbox_currentLayout,
611-
module : arguments.module,
612-
explicitModule: cbox_explicitModule,
613-
isLayout : true
614-
);
608+
// Layout location holder — only populated when layout is non-empty.
609+
// discoverViewPaths throws on an empty layout name (regression vs ColdBox 7).
610+
var layoutLocations = { viewPath : "", viewHelperPath : [] };
615611

616-
// If Layout is blank, then just delegate to the view
617-
// No layout rendering.
612+
// If Layout is blank, then just delegate to the view (no layout rendering).
618613
if ( len( cbox_currentLayout ) eq 0 ) {
619614
iData.renderedLayout = this.view();
620615
} else {
621-
// Render the layout with it's helpers
616+
layoutLocations = discoverViewPaths(
617+
view : cbox_currentLayout,
618+
module : arguments.module,
619+
explicitModule: cbox_explicitModule,
620+
isLayout : true
621+
);
622622
iData.renderedLayout = renderViewComposite(
623623
view : cbox_currentLayout,
624624
viewPath : layoutLocations.viewPath,

0 commit comments

Comments
 (0)