From cc113c663cd26a689decfc2d7cd34a929b1d4030 Mon Sep 17 00:00:00 2001 From: eshifri <46511024+eshifri@users.noreply.github.com> Date: Sat, 1 Oct 2022 22:11:49 -0700 Subject: [PATCH] fix(cpn): Crash when "Set Main Screen" GF used and no model exists (#2439) --- companion/src/modeledit/customfunctions.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 17b520e65..af6430b6c 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -510,7 +510,10 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) } else if (func == FuncSetScreen) { fswtchParam[i]->setDecimals(0); fswtchParam[i]->setMinimum(1); - fswtchParam[i]->setMaximum(model->getCustomScreensCount()); + if(model) + fswtchParam[i]->setMaximum(model->getCustomScreensCount()); + else + fswtchParam[i]->setMaximum(1); fswtchParam[i]->setSingleStep(1); cfn.param = fswtchParam[i]->value(); fswtchParam[i]->setValue(cfn.param);