diff --git a/CHANGELOG.md b/CHANGELOG.md
index 16e25761fd3435a16f4872d7e52c7c8957b34fcb..cfedd2cc49326f015c15f47b38dc44636fbcab12 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 # Version 1.102 (not yet released)
 
+* Fixed issue with export output and php 8.
 * Fix for deprecated function calls. See #142
 * A data processor output now works in Drupal 10 after saving (without clearing the caches).
 
diff --git a/CRM/DataprocessorOutputExport/Form/OutputExport.php b/CRM/DataprocessorOutputExport/Form/OutputExport.php
index f9e8e7be7a61c5c1f6cc383c7459516d3ae12cf1..c3ce23f6d3b523a652bff9b0f600751b7f2986d2 100644
--- a/CRM/DataprocessorOutputExport/Form/OutputExport.php
+++ b/CRM/DataprocessorOutputExport/Form/OutputExport.php
@@ -67,7 +67,7 @@ class CRM_DataprocessorOutputExport_Form_OutputExport extends CRM_Core_Form {
     $this->dataProcessorClass = $form->getDataProcessorClass();
     $this->dataProcessor = $form->getDataProcessor();
     $this->idFieldName = $form->getIdFieldName();
-    if ($form->getSort()->getCurrentSortID() > 1) {
+    if ($form->getSort() && $form->getSort()->getCurrentSortID() > 1) {
       $sortField = $form->getSort()->_vars[$form->getSort()->getCurrentSortID()];
       if ($form->getSort()->getCurrentSortDirection() == CRM_Utils_Sort::DESCENDING) {
         $this->sortDirection = 'DESC';