aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-17 19:44:41 +1000
committerDavid Walter Seikel2012-01-17 19:44:41 +1000
commitc05f3c576d24d78b69e4847019641f28d2a1868b (patch)
treea31500753f2c6d95686b66bfc5e26dc5d337962b
parentMore damn operation validation. (diff)
downloadSledjHamr-c05f3c576d24d78b69e4847019641f28d2a1868b.zip
SledjHamr-c05f3c576d24d78b69e4847019641f28d2a1868b.tar.gz
SledjHamr-c05f3c576d24d78b69e4847019641f28d2a1868b.tar.bz2
SledjHamr-c05f3c576d24d78b69e4847019641f28d2a1868b.tar.xz
Some extra protection and debugging, coz something is making broken tokens. B-(
-rw-r--r--LuaSL/src/LuaSL_compile.c14
1 files 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,
257 lType = OT_nothing; 257 lType = OT_nothing;
258 else 258 else
259 { 259 {
260 if ((LSL_IDENTIFIER == left->token->type) && (left->value.identifierValue)) 260 if ((left->token) && (LSL_IDENTIFIER == left->token->type) && (left->value.identifierValue))
261 { 261 {
262 LSL_Leaf *var = findVariable(compiler, left->value.identifierValue->name); 262 LSL_Leaf *var = findVariable(compiler, left->value.identifierValue->name);
263 263
@@ -273,7 +273,7 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval,
273 rType = OT_nothing; 273 rType = OT_nothing;
274 else 274 else
275 { 275 {
276 if ((LSL_IDENTIFIER == right->token->type) && (right->value.identifierValue)) 276 if ((right->token) && (LSL_IDENTIFIER == right->token->type) && (right->value.identifierValue))
277 { 277 {
278 LSL_Leaf *var = findVariable(compiler, right->value.identifierValue->name); 278 LSL_Leaf *var = findVariable(compiler, right->value.identifierValue->name);
279 279
@@ -329,12 +329,18 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval,
329 329
330 if (left) 330 if (left)
331 { 331 {
332 leftToken = left->token->token; 332 if (left->token)
333 leftToken = left->token->token;
334 else
335 PE("BROKEN LEFT TOKEN!!!!!!!!!!!!!!!!!!");
333 leftType = allowed[left->basicType].name; 336 leftType = allowed[left->basicType].name;
334 } 337 }
335 if (right) 338 if (right)
336 { 339 {
337 rightToken = right->token->token; 340 if (right->token)
341 rightToken = right->token->token;
342 else
343 PE("BROKEN RIGHT TOKEN!!!!!!!!!!!!!!!!!!");
338 rightType = allowed[right->basicType].name; 344 rightType = allowed[right->basicType].name;
339 } 345 }
340 346