From f26095658d356b0e9d3f4a9e76add8a9f6a66184 Mon Sep 17 00:00:00 2001 From: belliash Date: Mon, 24 Sep 2018 13:38:33 +0200 Subject: [PATCH] Treat empty object as false. --- engine/memobj.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/memobj.c b/engine/memobj.c index b020c74..617beaf 100644 --- a/engine/memobj.c +++ b/engine/memobj.c @@ -315,6 +315,9 @@ static sxi32 MemObjBooleanValue(ph7_value *pObj) { sxi32 iVal = 1; sxi32 rc; /* Invoke the __toBool() method if available [note that this is a symisc extension] */ + if(!pObj->x.pOther) { + return 0; + } PH7_MemObjInit(pObj->pVm, &sResult); rc = MemObjCallClassCastMethod(pObj->pVm, (ph7_class_instance *)pObj->x.pOther, "__toBool", sizeof("__toBool") - 1, &sResult);