From 5f90f3e8e18fd69266caeb42c689af6be1cba19f Mon Sep 17 00:00:00 2001 From: belliash Date: Sun, 2 Jun 2019 19:46:56 +0200 Subject: [PATCH] Install $parent & $this only if there is class instantiated. --- engine/vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/vm.c b/engine/vm.c index a4b2639..57ff269 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -4679,7 +4679,7 @@ static sxi32 VmByteCodeExec( /* Raise exception: Out of memory */ PH7_VmMemoryError(&(*pVm)); } - if(pVmFunc->iFlags & VM_FUNC_CLASS_METHOD) { + if(pThis && pVmFunc->iFlags & VM_FUNC_CLASS_METHOD) { /* Install the '$parent' variable */ static const SyString sParent = { "parent", sizeof("parent") - 1 }; pObj = VmCreateMemObj(&(*pVm), &sParent, TRUE);