title: My code is returning null somehow, I have no idea why
body: <p>I am creating a maze generator as a side project for fun, and I am running into an issue where </p>
  
  <pre><code>newTile.getxCoord()
  </code></pre>
  
  <p>is creating a null pointer exception, and I have no idea why. I checked to ensure the creation of my "tile" is using positive values that exist within the bounds of my board.</p>
  
  <p>Here is the link to the method and code as a whole <a href="https://github.com/Dibes/Maze/blob/master/src/MazeCreation/DepthFirst.java#L30" rel="nofollow">https://github.com/Dibes/Maze/blob/master/src/MazeCreation/DepthFirst.java#L30</a>.</p>
  
  <p>For a quick walk through of my thought process for this code</p>
  
  <pre><code>// Set the starting tile as visited and current
      TileGenerator.setTileVisible(Maze.startingTile.getxCoord(), Maze.startingTile.getyCoord(), 0);
  // Set the starting tile as the current tile
      TileGenerator.setTileCurrent(Maze.startingTile.getxCoord(), Maze.startingTile.getyCoord(), 1);
      // Set the last tile as the starting tile
      Tile lastTile = Maze.startingTile;
      // Grab a new tile that is within the bounds of the map and is greater than 0
      Tile newTile = TileGenerator.getTile(Utility.getHorizNext(lastTile.getxCoord(), -1, 1), Utility.getVertNext(lastTile.getyCoord(), -1, 1));
      while(!TileGenerator.isTilesVisited()) {
          // Debug testing
          if (newTile.getxCoord() &lt; 0 || newTile.getyCoord() &lt; 0) {
              System.out.println(newTile.getxCoord() + " " + newTile.getyCoord());
          }
          // Set the current tile visible
          TileGenerator.setTileVisible(newTile.getxCoord(), newTile.getyCoord(), 0);
          // Set the last tile marked as not current
          TileGenerator.setTileCurrent(lastTile.getxCoord(), lastTile.getyCoord(), 0);
          // Set the newly found tile marked as current (shows up as red on the board)
          TileGenerator.setTileCurrent(newTile.getxCoord(), newTile.getyCoord(), 1);
          // Grab new tile
          lastTile = newTile;
          newTile = TileGenerator.getTile(Utility.getHorizNext(lastTile.getxCoord(), -1, 1), Utility.getVertNext(lastTile.getyCoord(), -1, 1));
          // A sleep in the thread so i could see the generation slowly
          try {
              Thread.sleep(200);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>Sorry for being brief, I just am not sure why it would be creating a null pointer.</p>