title: Anylogic: How to fix NullPointerException error within function?
body: <p>I get a <strong>NullPointerException</strong> error in this scentence in my Anylogic model:</p>
  <p><code>if (directRoute.routeCosts.get(&quot;Day&quot;) &lt; toHubRoute.routeCosts.get(&quot;Night&quot;) + fromHubRoute.routeCosts.get(&quot;Day&quot;)) { </code></p>
  <p>This scentence is located within this function where the cheapest route should be found (to drive directly or via hub located in Region102), for every order that has to go from a certain terminal to certain customer.</p>
  <p><a href="https://i.stack.imgur.com/PROfW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PROfW.png" alt="enter image description here" /></a></p>
  <p>The function is referring to the routes and costs of the following list:</p>
  <p><a href="https://i.stack.imgur.com/zsp4z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zsp4z.png" alt="enter image description here" /></a></p>
  <p>The data sets for routes and costs are:</p>
  <p><a href="https://i.stack.imgur.com/mZvJo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mZvJo.png" alt="![enter image description here" /></a><a href="https://i.stack.imgur.com/esqlA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/esqlA.png" alt="enter image description here" /></a></p>
  <p>Does anybody know why I get this error and how to fix it?</p>
  <p>Thank you!</p>