Fix #109869: Switch View node crashes on editing

The Switch View node crashes on editing the compositor node tree with
the GPU compositor enabled.

That's because interactive edits are are in contexts that are not
multi-view, which is indicated by an empty view name.

To fix this, we fallback to the first input for non multi-view contexts.
This commit is contained in:
Omar Emara
2023-07-19 14:51:34 +03:00
parent 9cacdf6c42
commit 4c72dc98c2

View File

@@ -151,8 +151,16 @@ class SwitchViewOperation : public NodeOperation {
void execute() override
{
Result &input = get_input(context().get_view_name());
Result &result = get_result("Image");
/* A context that is not multi view, pass the first input through as a fallback. */
if (context().get_view_name().is_empty()) {
Result &input = get_input(node().input(0)->identifier);
input.pass_through(result);
return;
}
Result &input = get_input(context().get_view_name());
input.pass_through(result);
}
};