mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-02 11:33:59 -06:00
Fix crash when referencing an invalid variable name (#2486)
Fix crash when referencing an invalid variable name using the old placeholder parser syntax
This commit is contained in:
parent
66fe13f403
commit
e641903b16
1 changed files with 5 additions and 2 deletions
|
@ -810,9 +810,12 @@ namespace client
|
||||||
const ConfigOption *opt = ctx->resolve_symbol(opt_key_str);
|
const ConfigOption *opt = ctx->resolve_symbol(opt_key_str);
|
||||||
if (opt == nullptr) {
|
if (opt == nullptr) {
|
||||||
// Check whether the opt_key ends with '_'.
|
// Check whether the opt_key ends with '_'.
|
||||||
if (opt_key_str.back() == '_')
|
if (opt_key_str.back() == '_') {
|
||||||
opt_key_str.resize(opt_key_str.size() - 1);
|
opt_key_str.resize(opt_key_str.size() - 1);
|
||||||
opt = ctx->resolve_symbol(opt_key_str);
|
opt = ctx->resolve_symbol(opt_key_str);
|
||||||
|
}
|
||||||
|
if (opt == nullptr)
|
||||||
|
ctx->throw_exception("Variable does not exist", opt_key);
|
||||||
}
|
}
|
||||||
if (! opt->is_vector())
|
if (! opt->is_vector())
|
||||||
ctx->throw_exception("Trying to index a scalar variable", opt_key);
|
ctx->throw_exception("Trying to index a scalar variable", opt_key);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue