title: List iterator not dereferencable run time
body: <p>I am getting this error on runtime Expression: List iterator not dereferencable.  below is the code I am using.</p>
  
  <p>header file</p>
  
  <pre><code>//-----------------------------------------------------------------------------
  //
  //  Name:   Fletcher_TargetingSystem.h
  //
  //  Author: Alan Fletcher (20040797)
  //
  //  Desc:   class to select a target from the opponents currently in a bot's
  //          perceptive memory.
  //-----------------------------------------------------------------------------
  #include "2d/Vector2D.h"
  #include &lt;list&gt;
  #include "../../AbstTargetingSystem.h"
  
  
  class AbstRaven_Bot;
  
  class Fletcher_TargetingSystem : public AbstTargetingSystem
  {
  
  public:
      Fletcher_TargetingSystem(AbstRaven_Bot* owner);
  
      //each time this method is called the opponents in the owner's sensory 
      //memory are examined and the closest  is assigned to m_pCurrentTarget.
      //if there are no opponents that have had their memory records updated
      //within the memory span of the owner then the current target is set
      //to null
  
      void       Update();
      void         closestBotStrategy();
  
      void      setCurrentTarget(AbstRaven_Bot* t);
      AbstRaven_Bot* getCurrentTarget();
  
      void      setCurrentOwner(AbstRaven_Bot* t);
      AbstRaven_Bot* getCurrentOwner();
  };
  
  class Fletcher_getClosestBotStrategy
  {
  
  public:
      Fletcher_getClosestBotStrategy()
      {}
      Fletcher_getClosestBotStrategy(AbstRaven_Bot* owner);
  
      //each time this method is called the opponents in the owner's sensory 
      //memory are examined and the closest  is assigned to m_pCurrentTarget.
      //if there are no opponents that have had their memory records updated
      //within the memory span of the owner then the current target is set
      //to null
      void      pickTarget(AbstRaven_Bot&amp; owner);
  };
  
  #endif
  </code></pre>
  
  <p>c++ file</p>
  
  <pre><code>#include "Fletcher_TargetingSystem.h"
  #include "../../AbstRaven_Bot.h"
  #include "../../Raven_SensoryMemory.h"
  #include "../../Debug/DebugConsole.h"
  
  
  //-------------------------------- ctor ---------------------------------------
  //-----------------------------------------------------------------------------
  Fletcher_TargetingSystem::Fletcher_TargetingSystem(AbstRaven_Bot* owner):
  AbstTargetingSystem(owner){
  
  }
  
  //-------------------------------- ctor ---------------------------------------
  //-----------------------------------------------------------------------------
  Fletcher_getClosestBotStrategy::Fletcher_getClosestBotStrategy(AbstRaven_Bot* owner){
  
  }
  std::list&lt;AbstRaven_Bot*&gt; SensedBots;
  std::list&lt;AbstRaven_Bot*&gt;::const_iterator curBot;
  //----------------------------- Update ----------------------------------------
  
  //-----------------------------------------------------------------------------
  //----------------------------- closestPlayer ----------------------------------------
  
  //-----------------------------------------------------------------------------
  void Fletcher_getClosestBotStrategy::pickTarget(AbstRaven_Bot&amp; owner)
  {
  
      double ClosestDistSoFar = MaxDouble;
  
      Fletcher_TargetingSystem *fTS = new Fletcher_TargetingSystem(&amp;owner);
  
  
      for (curBot; curBot != SensedBots.end(); ++curBot)
      {
          //make sure the bot is alive and that it is not the owner
          if ((*curBot)-&gt;isAlive() &amp;&amp; (*curBot != fTS-&gt;getCurrentOwner()) )
          {
              double dist = Vec2DDistanceSq((*curBot)-&gt;Pos(), fTS-&gt;getCurrentOwner()-&gt;Pos());
              if (dist &lt; ClosestDistSoFar)
              {
                  ClosestDistSoFar = dist;
                  fTS-&gt;setCurrentTarget(*curBot);// = *curBot;
              }
  
          }
      }
      //return *fTS;
  }
  
  void Fletcher_TargetingSystem::Update()
  {
      // currentStrategy = targetClosestBotStrategy;
      // target = currentStrategy.pickTarget();
      //std::list&lt;AbstRaven_Bot*&gt; SensedBots;
      SensedBots = getCurrentOwner()-&gt;GetSensoryMem()-&gt;GetListOfRecentlySensedOpponents();
      curBot = SensedBots.begin();
      //std::list&lt;AbstRaven_Bot*&gt;::const_iterator curBot = SensedBots.begin();
      setCurrentTarget(0);//       = 0;
  
      Fletcher_getClosestBotStrategy* fGCBS = new Fletcher_getClosestBotStrategy(this-&gt;getCurrentOwner());
      fGCBS-&gt;pickTarget(**curBot);
  }
  
  AbstRaven_Bot* Fletcher_TargetingSystem::getCurrentOwner(){
      return m_pOwner;
  }
  AbstRaven_Bot* Fletcher_TargetingSystem::getCurrentTarget(){
      return m_pCurrentTarget;
  }
  
  void Fletcher_TargetingSystem::setCurrentTarget(AbstRaven_Bot* t){
      m_pCurrentTarget = t;
  }
  void Fletcher_TargetingSystem::setCurrentOwner(AbstRaven_Bot* t){
      m_pOwner = m_pOwner;
  }
  </code></pre>
  
  <p>any help in telling me how to fix this would be appreciated
  Thanking You</p>
  
  <p>Also what does the error mean exactly and how/when does it occur</p>