title: C++ exception handling, error
body: <p>I am using a library, RapidXML, but my problem is more general. The library parses xml like <code>item-&gt;first_node("CRAP")-&gt;first_node("CRAP")</code> Now, if I put this in an <code>if</code> statement it will crash. If I put this: <code>item-&gt;first_node("CRAP")</code> it won't.</p>
  
  <p>I am a beginner in C++ and I don't know much about exceptions but:</p>
  
  <pre><code>try
  {
      if(item-&gt;first_node("CRAP")-&gt;first_node("CRAP"))
      {
  
      }
      cout &lt;&lt; "OK";
  } catch (...)
  {
      cout &lt;&lt; "CRASH";
  }
  </code></pre>
  
  <p>The above crashes. How to check if my node exists without crashes (and without looping all the items one by one)?</p>