From c05f3c576d24d78b69e4847019641f28d2a1868b Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 17 Jan 2012 19:44:41 +1000 Subject: Some extra protection and debugging, coz something is making broken tokens. B-( --- LuaSL/src/LuaSL_compile.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 5bdfa9b..99ba53e 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -257,7 +257,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, lType = OT_nothing; else { - if ((LSL_IDENTIFIER == left->token->type) && (left->value.identifierValue)) + if ((left->token) && (LSL_IDENTIFIER == left->token->type) && (left->value.identifierValue)) { LSL_Leaf *var = findVariable(compiler, left->value.identifierValue->name); @@ -273,7 +273,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, rType = OT_nothing; else { - if ((LSL_IDENTIFIER == right->token->type) && (right->value.identifierValue)) + if ((right->token) && (LSL_IDENTIFIER == right->token->type) && (right->value.identifierValue)) { LSL_Leaf *var = findVariable(compiler, right->value.identifierValue->name); @@ -329,12 +329,18 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, if (left) { - leftToken = left->token->token; + if (left->token) + leftToken = left->token->token; + else + PE("BROKEN LEFT TOKEN!!!!!!!!!!!!!!!!!!"); leftType = allowed[left->basicType].name; } if (right) { - rightToken = right->token->token; + if (right->token) + rightToken = right->token->token; + else + PE("BROKEN RIGHT TOKEN!!!!!!!!!!!!!!!!!!"); rightType = allowed[right->basicType].name; } -- cgit v1.1