From 99644f0b35c05c149bfacd750aa3e8516a6f1238 Mon Sep 17 00:00:00 2001 From: supermerill Date: Wed, 10 Aug 2022 23:41:55 +0200 Subject: [PATCH] warning when using a scripted widget without code, instead of crashing. --- src/slic3r/GUI/OptionsGroup.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index cf02df6f836..fa63bd0add0 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -594,7 +594,12 @@ void OptionsGroup::update_script_presets() { if (key_opt.second.opt.is_script) { Field* field = get_field(key_opt.first); if (field) { - this->set_value(key_opt.first, key_opt.second.script->call_script_function_get_value(key_opt.second.opt)); + boost::any val = key_opt.second.script->call_script_function_get_value(key_opt.second.opt); + if (val.empty()) { + MessageDialog(nullptr, "Error, can't find the script to get the value for the widget '" + key_opt.first + "'", _L("Error"), wxOK | wxICON_ERROR).ShowModal(); + } else { + this->set_value(key_opt.first, val); + } } //if not, it will set at ConfigOptionsGroup::reload_config() } }