Problem/Motivation

I installed the module and noticed there was an update available. When I ran `drush updatedb`, I got the following error:

>  [notice] Update started: simple_sitemap_update_8203                                                                                                                                         
>  [error]  Argument 1 passed to Drupal\Core\Config\Config::setData() must be of the type array, null given, called in /srv/www/site/docroot/modules/contrib/simple_sitemap/simple_sitemap.inst
all on line 298                                                                                                                                                                                
>  [error]  Update failed: simple_sitemap_update_8203

The error is caused by saving `$old_config->get('settings');` when there are currently no settings yet.

Proposed resolution

Testing this locally, setting an if statement around the block checking first if `$old_config->get('settings');` exists, it resolves the issue.

Comments

redbrickone created an issue. See original summary.

redbrickone’s picture

I resolved the issue adding an if statement around the old settings. Attaching my patch here.

redbrickone’s picture

StatusFileSize
new679 bytes

Adjusted code to be a little quicker.

redbrickone’s picture

Status: Active » Needs review
chrissnyder’s picture

Status: Needs review » Reviewed & tested by the community
gbyte’s picture

Version: 8.x-3.7 » 8.x-3.x-dev
Status: Reviewed & tested by the community » Needs review

Wow community has been very quick with reviewing this one. ;)

Please always open up bug reports against the dev version.

gbyte’s picture

Status: Needs review » Closed (cannot reproduce)

Thanks for the patch, however I just installed 2.1 and without doing anything else upgraded to 3.x without a hitch. If you were missing that data it probably means your installation went wrong in the first place, as the settings array is part of the configuration that gets installed on module install. Please reopen this issue if you manage to reproduce it.