title: Fatal error: Call to a member function getMethodInstance() on a non-object in magento
body: <p>I am integrating magento payumoney gateway.I am using payumoney extension available on payumoney website.But it's through this error</p>
  
  <pre><code>Fatal error: Call to a member function getMethodInstance() on a non-object in D:\xampp\htdocs\build\store\app\code\core\Mage\Payment\Model\Observer.php on line 46
  </code></pre>
  
  <p>on this url</p>
  
  <pre><code>http://localhost/build/store/index.php/payucheckout/shared/redirect/
  </code></pre>
  
  <p>for this I follow this <a href="https://magento.stackexchange.com/questions/31517/magento-fatal-error-call-to-a-member-function-getmethodinstance-on-a-non-obje">https://magento.stackexchange.com/questions/31517/magento-fatal-error-call-to-a-member-function-getmethodinstance-on-a-non-obje</a></p>
  
  <p>but can't understand what going on. 
  my website observer code</p>
  
  <pre><code>$order = $observer-&gt;getEvent()-&gt;getOrder();
  
      if ($order-&gt;getPayment()-&gt;getMethodInstance()-&gt;getCode() != 'free') {
          return $this;
      } 
  </code></pre>
  
  <p>to remove this error i have update my magento from old version to new please help to find out. </p>