Katie Horn has submitted this change and it was merged.
Change subject: Fix hook fail on api email creation
......................................................................
Fix hook fail on api email creation
Email edit hook was crashing when we created new emails via the
CiviCRM API, since it was trying to examine properties of a null
object reference.
Change-Id: I87ad54656f1561c04e264bdcf56836406e5e6837
---
M sites/all/modules/wmf_communication/wmf_communication.module
1 file changed, 6 insertions(+), 2 deletions(-)
Approvals:
Katie Horn: Looks good to me, approved
diff --git a/sites/all/modules/wmf_communication/wmf_communication.module
b/sites/all/modules/wmf_communication/wmf_communication.module
index 1e38526..8f60c2e 100644
--- a/sites/all/modules/wmf_communication/wmf_communication.module
+++ b/sites/all/modules/wmf_communication/wmf_communication.module
@@ -120,8 +120,12 @@
* @param CRM_Core_DAO_Email $email new email object.
*/
function wmf_communication_civicrm_pre( $op, $type, $id, &$email ) {
- // only deal with Emails, and ignore on_hold status changes
- if ( $type !== 'Email' || ( $email->on_hold && $email->on_hold !==
'null' ) ) {
+ // only work with Emails, and only when we have an object reference
+ if ( $type !== 'Email' || $email === null ) {
+ return;
+ }
+ // ignore on_hold status changes
+ if ( $email->on_hold && $email->on_hold !== 'null' ) {
return;
}
if ( $op !== 'edit' && $op !== 'delete' ) {
--
To view, visit https://gerrit.wikimedia.org/r/170388
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I87ad54656f1561c04e264bdcf56836406e5e6837
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Katie Horn <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits