Answers.Body: <p><strong>UPD:</strong> Apparently this happens if some Location Types have no Labels.</p>
  <hr />
  <p>Rather simple fix: change from</p>
  <ul>
  <li><code>protected function getLocationTypeLabel($type): string {</code></li>
  </ul>
  <p>to</p>
  <ul>
  <li><code>protected function getLocationTypeLabel($type): ?string {</code></li>
  </ul>
  <p>in <strong>www/wp-content/plugins/civicrm/civicrm/CRM/Contact/Import/Form/MapField.php:480</strong></p>
  <p>however not sure it's the right thing to do.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-31T14:49:01.550Z
Answers.Text: The question really is whether it is valid not to have a label.  If it is, then it should probably return an empty string rather than null so changing the next line may be better to become:  `return $this->getLocationTypes()[$type] ?? '';`     Since it is not causing a problem on master then it may have been addressed in a different way already but if you want to post a PR someone will review and either accept your change or suggest a better way - be sure to include a valid scenario where the label is blank.
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-31T16:30:36.310Z
Answers.Text: I don't think it is possible to have an address location type without a label. It's a required field. Do you have an address type without a label? If not, it sounds like something else is broken.
Answers.UserDisplayName: Lars SG
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-01T09:27:17.220Z
Answers.Text: Aidan, LarsSG : thank you for pointers, now I realise where this came from (empty Location Type labels) - thought initially this is because  Primary location type has been disabled ( not deleted ) at /wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2FlocationType&reset=1 Not sure why this has been configured like so, however it throws an error so maybe worth patching one way or another.
Answers.UserDisplayName: yurg
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-31T09:57:33.717Z
Answers.LastActivityDate: 2023-08-02T08:14:20.110Z
Answers.LastEditDate: 2023-08-02T08:14:20.110Z
Answers.UserDisplayName: yurg
Body: <p>Not a question as such, rather an observation.
  WordPress contacts import from CSV, CiviCRM 5.61.2. (not reproduceable on dmaster).</p>
  <p><code>Uncaught TypeError: Return value of CRM_Contact_Import_Form_MapField::getLocationTypeLabel() must be of the type string, null returned in www/wp-content/plugins/civicrm/civicrm/CRM/Contact/Import/Form/MapField.php:480 </code></p>
  
Tags: <import><data-import><csv><location-type>
Title: Contacts Import issue at CRM_Contact_Import_Form_MapField::getLocationTypeLabel
ThreadText: # Contacts Import issue at CRM_Contact_Import_Form_MapField::getLocationTypeLabel
  
  (Asked by: username_0 on 2023-07-31)
  
  Not a question as such, rather an observation.
  WordPress contacts import from CSV, CiviCRM 5.61.2. (not reproduceable on dmaster).
  
  `Uncaught TypeError: Return value of CRM_Contact_Import_Form_MapField::getLocationTypeLabel() must be of the type string, null returned in www/wp-content/plugins/civicrm/civicrm/CRM/Contact/Import/Form/MapField.php:480`
  
  **Tags:** import, data-import, csv, location-type
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-07-31. Score: 0
  
  **UPD:** Apparently this happens if some Location Types have no Labels.
  
  ---
  
  Rather simple fix: change from
  
  * `protected function getLocationTypeLabel($type): string {`
  
  to
  
  * `protected function getLocationTypeLabel($type): ?string {`
  
  in **www/wp-content/plugins/civicrm/civicrm/CRM/Contact/Import/Form/MapField.php:480**
  
  however not sure it's the right thing to do.
  
  > **Comments:**
  > **username_1**: The question really is whether it is valid not to have a label.  If it is, then it should probably return an empty string rather than null so changing the next line may be better to become:  `return $this->getLocationTypes()[$type] ?? '';`     Since it is not causing a problem on master then it may have been addressed in a different way already but if you want to post a PR someone will review and either accept your change or suggest a better way - be sure to include a valid scenario where the label is blank.  
  > **username_2**: I don't think it is possible to have an address location type without a label. It's a required field. Do you have an address type without a label? If not, it sounds like something else is broken.  
  > **username_0**: username_1, username_2 : thank you for pointers, now I realise where this came from (empty Location Type labels) - thought initially this is because  Primary location type has been disabled ( not deleted ) at /wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2FlocationType&reset=1 Not sure why this has been configured like so, however it throws an error so maybe worth patching one way or another.  
  
  ---
  
  