When you have menu_link entities enabled for simple_sitemap, and there is some menu items disabled, after enabling the module or generate sitemap with drush, it crash:
Error: Call to a member function isRouted() on null in Drupal\simple_sitemap\Batch\BatchUrlGenerator->generateBundleUrls() (line 132 of [error]
/var/www/ujaen.es/current/web/modules/contrib/simple_sitemap/src/Batch/BatchUrlGenerator.php).
Error: Call to a member function isRouted() on null in /var/www/ujaen.es/current/web/modules/contrib/simple_sitemap/src/Batch/BatchUrlGenerator.php on line 132
Error: Call to a member function isRouted() on null in Drupal\simple_sitemap\Batch\BatchUrlGenerator->generateBundleUrls() (line 132 of /var/www/ujaen.es/current/web/modules/contrib/simple_sitemap/src/Batch/BatchUrlGenerator.php).
After tracing the source code, I've found a logic problem in generateBundleUrls method of BatchUrlGenerator class.
Here you can see an use case about the need of using continue 2 instead continue in a switch sentende inside a loop. If you use continue, it works like break sentence. It's documented here.
This is the patch.
Thanks.
Comments
Comment #3
gbyteGood catch, thanks for the extensive issue description, that made it a breeze.