Issue #3417011 by nkoporec: Error: Call to a member function hasField() on null #3722
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.
Problem
In our logs we are spotting
Error: Call to a member function hasField() on null
errors, its related to a missing profile.Full error:
Solution
Even though the profile should always be there and I think this might even be a setup issue, we can still improve the code and
make sure to not call
hasField
method if the variable is not the correct type.Issue tracker
https://www.drupal.org/project/social/issues/3417011
Theme issue tracker
How to test
Definition of done
Before merge
After merge
Screenshots
Release notes
Fixed an issue with undefined error when sending an email to a user without a profile.
Change Record
Translations