Merge pull request #11578 from jitendrapurohit/CRM-20697
[civicrm-core.git] / CRM / Contribute / Form / Contribution / Main.php
index 9d7ed7c59b4bce1644644daddaa3a094a34c2080..89b92fbf3e98710b2fdce7061f66ad4be69f0ce5 100644 (file)
@@ -1300,6 +1300,9 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     if (empty($this->_ccid)) {
       return;
     }
+    if (!$this->getContactID()) {
+      CRM_Core_Error::statusBounce(ts("Returning since there is no contact attached to this contribution id."));
+    }
 
     $payment = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_ccid, 'contribution');
     //bounce if the contribution is not pending.