From 269d81ae5bbbf1518ec73cb5a3ff9bb5d26c4871 Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Wed, 28 Oct 2020 22:43:02 +0800 Subject: [PATCH] fixed bug of subvec --- nasal_runtime.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/nasal_runtime.h b/nasal_runtime.h index 4f78140..1e3c392 100644 --- a/nasal_runtime.h +++ b/nasal_runtime.h @@ -774,16 +774,13 @@ int nasal_runtime::call_vector(nasal_ast& node,int base_value_addr,int local_sco { end_index=begin_index<0? -1:reference_value.size()-1; } - else if(!begin_is_nil && !end_is_nil) + else if(!begin_is_nil && !end_is_nil && begin_index>=end_index) { - if(begin_index>=end_index) - { - std::cout<<">> [runtime] call_vector: begin index must be less than end index.\n"; - ++error; - return -1; - } + std::cout<<">> [runtime] call_vector: begin index must be less than end index.\n"; + ++error; + return -1; } - for(int i=begin_index;i