Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Protect against null values which could get passed in from incomplete/draft segment criteria:
In our installation, if authors create a segment but don't complete all the fields, in the segments list view (/admin/campaign/segments) we get a server error as below. This is a proposal to protect against null values, as per the error.
putyourlightson\campaign\elements\db\ContactElementQuery::email(): Argument #1 ($value) must be of type string, null given, called in /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/putyourlightson/craft-campaign/src/elements/conditions/contacts/EmailConditionRule.php on line 43 {"trace":["#0 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/putyourlightson/craft-campaign/src/elements/conditions/contacts/EmailConditionRule.php(43): putyourlightson\campaign\elements\db\ContactElementQuery->email()","#1 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/elements/conditions/ElementCondition.php(199): putyourlightson\campaign\elements\conditions\contacts\EmailConditionRule->modifyQuery()","#2 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/putyourlightson/craft-campaign/src/services/SegmentsService.php(142): craft\elements\conditions\ElementCondition->modifyQuery()","#3 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/putyourlightson/craft-campaign/src/services/SegmentsService.php(91): putyourlightson\campaign\services\SegmentsService->getFilteredContactIds()","#4 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/putyourlightson/craft-campaign/src/elements/SegmentElement.php(554): putyourlightson\campaign\services\SegmentsService->getContactIds()","#5 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/putyourlightson/craft-campaign/src/elements/SegmentElement.php(564): putyourlightson\campaign\elements\SegmentElement->getContactIds()","#6 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/putyourlightson/craft-campaign/src/elements/SegmentElement.php(276): putyourlightson\campaign\elements\SegmentElement->getContactCount()","#7 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/base/Element.php(4658): putyourlightson\campaign\elements\SegmentElement->tableAttributeHtml()","#8 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/twig/twig/src/Extension/CoreExtension.php(1607): craft\base\Element->getTableAttributeHtml()","#9 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/helpers/Template.php(129): twig_get_attribute()","#10 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/storage/runtime/compiled_templates/cf/cfb471811f0b0080bfc3f6449ed0d3e4.php(198): craft\helpers\Template::attribute()","#11 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/twig/twig/src/Template.php(394): __TwigTemplate_ed4b2b4c0ebfcec6d098bd52237a924d->doDisplay()","#12 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()","#13 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/storage/runtime/compiled_templates/69/69cc3856242b0ccf1b1be58dcfc116bd.php(127): Twig\Template->display()","#14 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/twig/twig/src/Template.php(394): __TwigTemplate_48a3800bb8b4ab197c6f92f8e0a9dca1->doDisplay()","#15 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()","#16 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/twig/twig/src/Template.php(379): Twig\Template->display()","#17 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render()","#18 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render()","#19 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/web/View.php(482): Twig\Environment->render()","#20 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/base/Element.php(1196): craft\web\View->renderTemplate()","#21 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(701): craft\base\Element::indexHtml()","#22 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(165): craft\controllers\ElementIndexesController->elementResponseData()","#23 [internal function]: craft\controllers\ElementIndexesController->actionGetElements()","#24 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","#25 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()","#26 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()","#27 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/web/Application.php(305): yii\base\Module->runAction()","#28 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/web/Application.php(606): craft\web\Application->runAction()","#29 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/craftcms/cms/src/web/Application.php(284): craft\web\Application->_processActionRequest()","#30 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()","#31 /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/web/index.php(12): yii\base\Application->run()","#32 {main}"],"memory":22396216,"exception":"[object] (TypeError(code: 0): putyourlightson\campaign\elements\db\ContactElementQuery::email(): Argument #1 ($value) must be of type string, null given, called in /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/putyourlightson/craft-campaign/src/elements/conditions/contacts/EmailConditionRule.php on line 43 at /home/737861.cloudwaysapps.com/vsxqdmbexx/public_html/craft/vendor/putyourlightson/craft-campaign/src/elements/db/ContactElementQuery.php:75)"}