From a167e4bc87cb56a5d724eca9147b8d35cf9c070c Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Fri, 29 Aug 2025 14:27:58 +0200 Subject: [PATCH] Permanently fix NULL comparision --- engine/memobj.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/engine/memobj.c b/engine/memobj.c index c5f3880..4030fd7 100644 --- a/engine/memobj.c +++ b/engine/memobj.c @@ -1077,11 +1077,16 @@ PH7_PRIVATE sxi32 PH7_MemObjCmp(ph7_value *pObj1, ph7_value *pObj2, int bStrict, iComb = pObj1->nType | pObj2->nType; if(iComb & (MEMOBJ_NULL | MEMOBJ_RES | MEMOBJ_BOOL)) { /* Explicitly handle NULL/VOID comparisons with numeric types */ - if ((pObj1->nType & (MEMOBJ_NULL | MEMOBJ_VOID)) || (pObj2->nType & (MEMOBJ_NULL | MEMOBJ_VOID))) { - /* Convert both operands to their numeric representation - * NULL/VOID will be converted to 0 by PH7_MemObjToNumeric */ + if(pObj1->nType & (MEMOBJ_NULL | MEMOBJ_VOID)) + { + /* Convert NULL/VOID to numeric */ PH7_MemObjToNumeric(pObj1); + } + if(pObj2->nType & (MEMOBJ_NULL | MEMOBJ_VOID)) { + /* Convert NULL/VOID to numeric */ PH7_MemObjToNumeric(pObj2); + } + if(PH7_MemObjIsNumeric(pObj1) && PH7_MemObjIsNumeric(pObj2)) { /* Jump to the numeric comparison section */ goto Numeric; }