Merge pull request #16545 from eileenmcnaughton/part_pend
[civicrm-core.git] / api / v3 / Contact.php
index 680583cf1e78bba3edd7d110f7595d03158714db..00c0bebe1d53647f9a54134cbbdc100ae53d089c 100644 (file)
@@ -81,6 +81,9 @@ function civicrm_api3_contact_create($params) {
 
   if (empty($params['contact_type']) && $contactID) {
     $params['contact_type'] = CRM_Contact_BAO_Contact::getContactType($contactID);
+    if (!$params['contact_type']) {
+      throw new API_Exception('Contact id ' . $contactID . ' not found.');
+    }
   }
 
   if (!isset($params['contact_sub_type']) && $contactID) {