title: Trying to receive a vector2f from an object pointer
body: <p>My main function checks if a key has been fired, and if it is left arrow/right arrow it calls a function in an object named Game that I created.
  When the code reaches the function inside Game I get an "access violation reading location" error.</p>
  
  <p>This is my main function:</p>
  
  <pre><code>int main()
  {
  sf::RenderWindow window(sf::VideoMode(800, 600), "PongZzZZzzZ");
  
  Ball *b = new Ball();
  Paddle *p = new Paddle();
  Game *game = new Game(&amp;window, b, p);
  
  while (window.isOpen())
  {
      sf::Event event;
      while (window.pollEvent(event))
      {
          if (event.type == sf::Event::Closed)
              window.close();
          else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
              game-&gt;ParseKey('r');
          else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
              game-&gt;ParseKey('l');
      }
      window.clear(sf::Color::White);
  
      window.draw(*p);
  
      window.display();
  }
  
  return 0;
  }
  </code></pre>
  
  <p>This is my function inside game:</p>
  
  <pre><code>void Game::ParseKey(char dir)
  {
  if (dir == 'r' &amp;&amp; (this-&gt;p-&gt;GetPosition().x + this-&gt;p-&gt;getSize().x) &lt; 795)
  {
      std::cout &lt;&lt; "right key fired";
  }
  else if (dir == 'l' &amp;&amp; (this-&gt;p-&gt;getPosition().x) &gt; 5)
  {
      std::cout &lt;&lt; "left key fired";
  }
  }
  </code></pre>
  
  <p>I know the problem is when I try to get the vector and get the x here:</p>
  
  <pre><code>this-&gt;p-&gt;GetPosition().x
  </code></pre>
  
  <p>I tried just getting the vector and it worked, but when I try to get the 'x' it crashes.</p>