Corrected single check for empty stack, which resulted in popping nonexistent operands when arrity > 1

This commit is contained in:
Vera Lewis
2024-03-27 04:42:14 -05:00
parent 375d371927
commit b0b7b07bfe

View File

@@ -138,13 +138,15 @@ operands(STACK* target_stack, int size)
*/
double * const _operands = (double*)malloc(size*sizeof(double));
if ((*target_stack) == NULL)
error |= ERR_NS_OPERANDS;
//#if ((*target_stack) == NULL)
// error |= ERR_NS_OPERANDS;
double * tPtr = _operands;
double * endPtr = _operands + size;
while ((tPtr < endPtr) && !error)
{
if ((*target_stack) == NULL)
error |= ERR_NS_OPERANDS;
*tPtr = peek((target_stack));
pop(target_stack);