title: Unhandled Exception Access Violation
body: <p>I apologize for the lengthy code but I've been trying to spot the error and really cant find it. Has the error when i try to run it.</p>
  
  <pre><code>void setADist(vector&lt;Facility&gt; &amp;vFac, vector&lt;Client&gt; &amp;vClient, vector&lt;Edge&gt; &amp;vEdge, vector&lt;Node&gt; &amp;vNode){
              ...
  
              vector&lt;Edge&gt; temp(vEdge);
              float *distance;
  
              ...
  
              temp.push_back(Edge(101, 101, facEndNode, py(vFac[i].getLongitude(), x, vFac[i].getLatitude(), y)));
  
              Graphs *g1 = new Graphs();
              struct Graph* graph1 = g1-&gt;createGraph(temp.size());
  
              for (int k = 0; k &lt; temp.size(); k++){
                  //g1-&gt;addEdge(graph1, temp[k].getStartNode(), temp[k].getEndNode(), temp[k].getDist()); //THIS LINE CAUSES THE EXCEPTION
              }
              //g1-&gt;printGraph(graph1);
              //distance = g1-&gt;dijkstra(graph1, vFac[i].getNodeID());
          }
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The commented line causes the exception when i call the method. <br>
  I have tried running the following code below separately in main() and no exception was found so it cant be anything to do with the class Graphs.</p>
  
  <pre><code>Graphs *g = new Graphs();
  struct Graph* graph = g-&gt;createGraph(vEdge.size());
  
  for (int i = 0; i &lt; vEdge.size(); i++){
      g-&gt;addEdge(graph, vEdge[i].getStartNode(), vEdge[i].getEndNode(), vEdge[i].getDist());
  }
  //g-&gt;printGraph(graph);
  </code></pre>
  
  <p>Really appreciate it if someone can provide me the solution.</p>