mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-07-26 21:08:45 +08:00
fix sigsegv error
This commit is contained in:
+3
-2
@@ -340,10 +340,11 @@ inline void nasal_vm::opr_pstr()
|
||||
}
|
||||
inline void nasal_vm::opr_newv()
|
||||
{
|
||||
nasal_ref newv=gc.alloc(vm_vec);
|
||||
nasal_ref newv=gc.alloc(vm_vec);
|
||||
auto& vec=newv.vec()->elems;// top-imm[pc] stores the vector
|
||||
vec.resize(imm[pc]);
|
||||
top-=imm[pc]-1;
|
||||
// use top-=imm[pc]-1 here will cause error if imm[pc] is 0
|
||||
top=top-imm[pc]+1;
|
||||
for(uint32_t i=0;i<imm[pc];++i)
|
||||
vec[i]=top[i];
|
||||
top[0]=newv;
|
||||
|
||||
Reference in New Issue
Block a user