Equation solver in Java - Values not being pushed onto stack
<p>I'm having a problem with a section of an equation solver. I have an array of Objects that hold the postfix equation, and this method evaluates each value. </p>

<p>The problem I'm having is that it crashes telling me that the list is empty (at this point: double num1 = ((double)operandStack.pop());)</p>

<p>Can someone tell me what I've done wrong here?</p>

<pre><code>    DSAQueue&lt;Object&gt; postfixQueue = new DSAQueue&lt;Object&gt;();
.
.
.
.


private double evaluatePostfix (Queue&lt;Object&gt; postfixQueue)
{

DSAStack&lt;Double&gt; operandStack = new Stack&lt;Double&gt;();
while (postfixQueue.isEmpty() == false)
    {
    if (postfixQueue.peek() instanceof Double)
        {
        operandStack.push((Double)(postfixQueue.dequeue()));
        }
    else
        {
        double num1 = ((double)operandStack.pop());
        double num2 = ((double)operandStack.pop());
        char operator = ((char)postfixQueue.dequeue());
        double result = executeOperation (operator, num1, num2);
        operandStack.push(result);
        }
    }
double solution = operandStack.top();
return solution;
}
</code></pre>
