Error when creating user record for Civi contact
In Drupal 8 (at least), when I choose to "Create User Record" from the "Actions" menu-button while viewing a CRM contact, it will show me the typical username/password form to complete, and when I submit it, it works, but I get this error message:
Notice: Trying to get property 'id' of non-object in CRM_Core_BAO_UFMatch::updateContactEmail() (line 449 of /var/www/sitename/vendor/civicrm/civicrm-core/CRM/Core/BAO/UFMatch.php).
When I try to create a user account from the Drupal side, for an email that already exists in Civi, I get the exact same error, but Civi creates a NEW contact which is empty except for the email, resulting in 2 contacts with duplicate emails.
Preferred behavior is, of course, for both actions to result in a properly matched up Drupal User and CiviCRM contact record.