From e514e05dc8c2c54ebb0a1177c7c0f15148c3078c Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Wed, 14 May 2025 20:22:25 +0200 Subject: [PATCH] Fix crash constant folding uninitialized constants --- oscar64/Declaration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oscar64/Declaration.cpp b/oscar64/Declaration.cpp index cfb7b11..883c19d 100644 --- a/oscar64/Declaration.cpp +++ b/oscar64/Declaration.cpp @@ -1167,7 +1167,7 @@ Expression* Expression::ConstantFold(Errors * errors, LinkerSection * dataSectio return ex; } else if (mType == EX_BINARY && mToken == TK_ADD && mLeft->mType == EX_VARIABLE && mLeft->mDecValue->mType == DT_VARIABLE && (mLeft->mDecValue->mFlags & DTF_CONST) && - mLeft->mDecValue && mRight->mDecValue && mLeft->mDecValue->mValue->mType == EX_CONSTANT && + mLeft->mDecValue && mRight->mDecValue && mLeft->mDecValue->mValue && mLeft->mDecValue->mValue->mType == EX_CONSTANT && mLeft->mDecType->mType == DT_TYPE_POINTER && mRight->mType == EX_CONSTANT && mRight->mDecValue->mType == DT_CONST_INTEGER) { mLeft = mLeft->mDecValue->mValue;