title: Error while trying to return a value.
body: <p>I'm stuck on the very last part of my homework. I have to return an Agent value, but for some reason I keep getting an error saying that "This method must return type Agent", even though what I am returning is an Agent. Any help would be greatly appreciated. </p>
  
  <pre><code>import java.io.File;
  import java.util.HashMap;
  
  import jeff.ini.Ini;
  
  public class ConfigLoader
  {
   private Ini _ini;
   private HashMap&lt;String, Space&gt; _spaces = new HashMap&lt;String, Space&gt;();
   private HashMap&lt;String, Portal&gt; _portals = new HashMap&lt;String, Portal&gt;();
   private HashMap&lt;String, Agent&gt; _agents = new HashMap&lt;String, Agent&gt;();
   public ConfigLoader(File iniFile)
   {
   _ini = new Ini(iniFile);
   }
   public Agent buildAll()
   {
       _buildSpaces();
       _buildPortals();
       _buildExits();
       _buildDestinations();
       _buildAgents();
       return _selectStartAgent();
  
   }
   private void _buildSpaces(){
          for(String spaceName : _ini.keys("spaces")){
              String descrip= _ini.get("spaces", spaceName);
              String image= _ini.get("images", "images");
              Space space1= new Space(spaceName, descrip, image, null);
              _spaces.put(spaceName, space1);
          }
          }
   private void _buildPortals(){
       for(String portalName : _ini.keys("portals")){
           String descrip= _ini.get("portal", portalName); 
           Portal portal1=new Portal(portalName, descrip, null);
           _portals.put(portalName, portal1);
       }
  
   }
   private void _buildExits(){
       for(String spaceName : _ini.keys("exits")){ 
              String spaceExit = _ini.get("exits", spaceName);
              Space space = _spaces.get(spaceName);
              Portal exit = _portals.get(spaceExit);
              space.setPortal(exit);
  
   }
   }
   private void _buildDestinations(){ 
             for(String portalName : _ini.keys("destinations")){
                 String destination = _ini.get("destinations", portalName);
                 Space des = _spaces.get(destination);
  
                 if(des == null){
                      System.out.print("ERROR");
                      System.exit(1); 
                  }
                  else{
  
                      Portal portal = _portals.get(portalName);
                      portal.setDestination(des);
  
                  }
  
              } 
   }
  
  private void _buildAgents(){
      for(String agentName : _ini.keys("agents")){
          String agent = _ini.get("agents" , agentName);
          Space space = _spaces.get(agent);
  
          if(space == null){
                      System.out.print("ERROR");
                      System.exit(1); 
                      }
               else{
                      Agent a = new Agent(space, agentName);
                      _agents.put(agentName, a);
                      }
  
           }
       }
  private Agent _selectStartAgent(){
  
      for(String agentName : _ini.keys("start")){
          String agent = _ini.get("start" , agentName);
          Agent agent1 = _agents.get(agent);
          if(agent == null){
                      System.out.print("ERROR");
                      System.exit(1); 
                      }
          else{
              return agent1;
          }
  
  
      }
  
  
      }
  
      }
  </code></pre>