Do not check function call depth if no_function.

This commit is contained in:
Stephen Chung 2020-05-28 14:08:07 +08:00
parent 30782212e4
commit e84d4a88e9

View File

@ -608,10 +608,13 @@ impl Engine {
let native_only = hashes.1 == 0; let native_only = hashes.1 == 0;
// Check for stack overflow // Check for stack overflow
#[cfg(not(feature = "no_function"))]
#[cfg(not(feature = "unchecked"))]
{
if level > self.max_call_stack_depth { if level > self.max_call_stack_depth {
return Err(Box::new(EvalAltResult::ErrorStackOverflow(pos))); return Err(Box::new(EvalAltResult::ErrorStackOverflow(pos)));
} }
}
// First search in script-defined functions (can override built-in) // First search in script-defined functions (can override built-in)
if !native_only { if !native_only {
if let Some(fn_def) = lib.get(&hashes.1) { if let Some(fn_def) = lib.get(&hashes.1) {