IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 8, 2017, 5:36:32 PM (9 years ago)
Author:
eugene
Message:

handle case of stack.name == NULL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20170908/Ohana/src/opihi/lib.shell/evaluate_stack.c

    r40205 r40207  
    188188          snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n", stack[i-1].name, stack[i-2].name);
    189189          push_error (line);
    190           if (strchr(stack[i-1].name, ':') || strchr(stack[i-2].name, ':')) {
     190          int isTrinary = TRUE;
     191          isTrinary = isTrinary && (i >= 2);
     192          // isTrinary = isTrinary && (stack[i - 1] != NULL);
     193          // isTrinary = isTrinary && (stack[i - 2] != NULL);
     194          isTrinary = isTrinary && (stack[i - 1].name != NULL);
     195          isTrinary = isTrinary && (stack[i - 2].name != NULL);
     196          isTrinary = isTrinary && (strchr(stack[i-1].name, ':') || strchr(stack[i-2].name, ':'));
     197          if (isTrinary) {
    191198            snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n(Note that the : in a trinary operation must be protected by spaces)\n", stack[i-1].name, stack[i-2].name);
    192199            push_error (line);
Note: See TracChangeset for help on using the changeset viewer.