Can code that doesn't execute cause segmentation fault? : <p>I have this piece of code working just fine. Statement in <code>if</code> is true which leads me to printing <code>TRUE</code>. However when I remove the content of <code>else</code> statement, this gives me segmentation fault, even if it doesn't execute (still prints <code>TRUE</code>). </p>

<p>Does anybody have any idea why whould it be that way?</p>

<pre><code>if(parser-&gt;checkToken(Token::Type::Int)) {
        std::cout &lt;&lt; "TRUE" &lt;&lt; std::endl;
        parser-&gt;scanner-&gt;getToken().getNumber();
        parser-&gt;advance();
} else {
        std::cout &lt;&lt; "FALSE" &lt;&lt; std::endl;
        parser-&gt;requireToken(Token::Type::String);
}
</code></pre>

<p>p.s. parser is unique_ptr</p>
