Call to a member function getFileUri() on null in ImageItem::presave() I have a node migration as part of a D6->D8 migration, and for the image field in the node, I've done a separate files migration, and then in my node migration, I just refer to the files migration to get the destination fid and write that to the image field. 

field_image:
  plugin: iterator
  source: field_thumbnail
  process:
    target_id:
      plugin: migration
      migration: file
      source: fid


The problem I'm running into is the error listed in the title. This is the presave() function:

public function preSave() {
  parent::preSave();

  $width = $this-&gt;width;
  $height = $this-&gt;height;

  // Determine the dimensions if necessary.
  if (empty($width) || empty($height)) {
    $image = \Drupal::service('image.factory')-&gt;get($this-&gt;entity-&gt;getFileUri());
    if ($image-&gt;isValid()) {
      $this-&gt;width = $image-&gt;getWidth();
      $this-&gt;height = $image-&gt;getHeight();
    }
  }
}


It seems like it's dying because there is no image for that node, because it's dying at this line:

$image = \Drupal::service('image.factory')-&gt;get($this-&gt;entity-&gt;getFileUri());


It works just fine when there is an image for the node. Shouldn't this be skipped if there is no image found in the files migration? Is there a config option in the .yml file I can use to avoid this error?

Thanks.

UPDATE: I found this docs page on the skip_on_empty process plugin, and implemented as suggested on that page:

field_image:
  plugin: iterator
  source: field_thumbnail 
    process:
    target_id:
    -
      plugin: migration
      migration: file
      source: fid
    -
      plugin: skip_on_empty
      method: row


but I still get the same error, more than likely because in the pipeline, it's already errored out before it gets to the skip_on_empty plugin. However, if I switch things around:

field_image:
  plugin: iterator
  source: field_thumbnail 
    process:
    target_id:
    -
      plugin: skip_on_empty
      method: row
    -
      plugin: migration
      migration: file
      source: fid


Then the entire blog node is skipped if there is no image. How can I just skip trying to migrate the image if there is none?
I a similar issue on a previous migration, I found that a core issue sometimes causes that error.

The patch submitted fixed the problem on my case.