]> Shamusworld >> Repos - rmac/blobdiff - expr.c
Fixed segfault on encountering unexpected register in RISC section.
[rmac] / expr.c
diff --git a/expr.c b/expr.c
index 0335fbd12de4f46173e5efb254b85c5302126ad3..7cedc41350529f3df19e1ccc61752bc75a824d6d 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -71,7 +71,7 @@ static VALUE str_value(char * p)
 //
 // Initialize Expression Analyzer
 //
-void init_expr(void)
+void InitExpression(void)
 {
        int i;                                                                  // Iterator
        char * p;                                                               // Token pointer
@@ -351,7 +351,7 @@ int expr(TOKEN * otk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
 
                        tok--;
                }
-               else
+               else if (*tok == STRING || *tok == SYMBOL)
                {
                        p = string[tok[1]];
                        j = (*p == '.' ? curenv : 0);
@@ -411,6 +411,13 @@ thrown away right here. What the hell is it for?
                        if ((symbol->sattr & (GLOBAL | DEFINED)) == GLOBAL && a_esym != NULL)
                                *a_esym = symbol;
                }
+               else
+               {
+                       // Unknown type here... Alert the user!
+                       error("undefined RISC register in expression");
+                       tok++;
+                       return ERROR;
+               }
 
                tok += 2;
                *evalTokenBuffer++ = ENDEXPR;