OJS Error upgrading from 3.0.2

I am trying to upgrade from OJS 3.0.2 to and I think I have a problem with the database. The upgrade script fails with the message:

PHP Fatal error: Call to a member function getId() on null in /var/www/html/ojs4/classes/install/Upgrade.inc.php on line 2489

Thanks for any suggestion,

I solved this problem with patch Update Upgrade.inc.php (issue #2506) by Vitaliy-1 · Pull Request #1630 · pkp/ojs · GitHub