[OJS3.4.0-4] PHP Fatal error: Uncaught TypeError: ksort(): Argument #1 ($array) must be of type array, null given in

OJS-3.4.0-4
PHP-8.1

Upgrade from OJS-3.3.0-14 to the OJS-3.4.0-4 version.
For some older submissions, we are not able to notify the author about the decision as on clicking the Request Revisions/Accept Submission/Decline Submission, it gives an error message as given below.

This page isn’t working
epubs.icar.org.in is currently unable to handle this request.
HTTP ERROR 500

PHP Fatal error:  Uncaught TypeError: ksort(): Argument #1 ($array) must be of type array, null given in /ojs/lib/pkp/classes/mail/traits/ReviewerComments.php:125
Stack trace:
#0 /ojs/lib/pkp/classes/mail/traits/ReviewerComments.php(125): ksort()
#1 /ojs/lib/pkp/classes/mail/traits/ReviewerComments.php(85): PKP\mail\mailables\DecisionRequestRevisionsNotifyAuthor->getReviewFormComments()
#2 /ojs/lib/pkp/classes/mail/mailables/DecisionRequestRevisionsNotifyAuthor.php(50): PKP\mail\mailables\DecisionRequestRevisionsNotifyAuthor->setupReviewerCommentsVariable()
#3 /ojs/lib/pkp/classes/decision/types/RequestRevisions.php(149): PKP\mail\mailables\DecisionRequestRevisionsNotifyAuthor->__construct()
#4 /ojs/lib/pkp/pages/decision/DecisionHandler.php(132): PKP\decision\types\RequestRevisions->getSteps()
#5 [internal function]: PKP\pages\decision\DecisionHandler->record()
#6 /ojs/lib/pkp/classes/core/PKPRouter.php(334): call_user_func()
#7 /ojs/lib/pkp/classes/core/PKPPageRouter.php(277): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest()
#8 /ojs/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\PKPPageRouter->route()
#9 /ojs/lib/pkp/classes/core/PKPApplication.php(388): PKP\core\Dispatcher->dispatch()
#10 /ojs/index.php(21): PKP\core\PKPApplication->execute()
#11 {main}
  thrown in /ojs/lib/pkp/classes/mail/traits/ReviewerComments.php on line 125