Problem/Motivation
I run a multisite on Drupal 8.9.11. On one of my sites, I recently started having the error described at https://www.drupal.org/forum/support/post-installation/2019-07-31/error-..., where a config import would error out with the following error:
[error] Error: Call to a member function delete() on null in Drupal\Core\Config\ConfigImporter->checkOp() (line 902 of /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php) #0 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(609): Drupal\Core\Config\ConfigImporter->checkOp('', 'create', 'system.menu.dev...')
#1 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(514): Drupal\Core\Config\ConfigImporter->processConfigurations(Array)
#2 /var/www/html/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(333): Drupal\Core\Config\ConfigImporter->doSyncStep('processConfigur...', Array)
#3 /var/www/html/vendor/drush/drush/includes/drush.inc(206): Drush\Drupal\Commands\config\ConfigImportCommands->doImport(Object(Drupal\Core\Config\StorageComparer))
#4 /var/www/html/vendor/drush/drush/includes/drush.inc(197): drush_call_user_func_array(Array, Array)
#5 /var/www/html/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(304): drush_op(Array, Object(Drupal\Core\Config\StorageComparer))
#6 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->import(NULL, Array)
#7 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#8 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#9 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/vendor/symfony/console/Application.php(1005): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(49): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#18 /var/www/html/vendor/drush/drush/includes/preflight.inc(18): require('/var/www/html/v...')
#19 phar:///usr/local/bin/drush/bin/drush.php(143): drush_main()
#20 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#21 {main}.
This only happens in my local and dev environments, and only one this one site. Copying the database from production or stage into the dev or local environments doesn't resolve the issue. Clearing the cache doesn't resolve the issue. Because I use Configuration Split to install different modules and change settings of other modules in certain environments, I checked the configuration between the site having the issue and my "default" site. Both matched exactly.
Proposed resolution
At https://www.drupal.org/forum/support/post-installation/2019-07-31/error-..., the resolution is to replace the code under the create operation of the switch statement in the checkOp function in core/lib/Drupal/Core/Config/ConfigImporter.php with code included in the forum post. However, the forum post assumes that $entity already has a value. If it doesn't, and the target config entity exists, $entity should be assigned that value and the operation should execute as expected. Otherwise, if it doesn't exist, it shouldn't execute the delete operation to avoid erroring out unnecessarily.
Hopefully I've described the issue adequately. I'd be happy to check other areas of my configuration, database, etc. if needed to ensure this is actually an issue needing correction and not just something wrong with my site.