 .../path/src/Plugin/Field/FieldWidget/PathWidget.php      |  2 +-
 core/modules/path/tests/src/Kernel/PathItemTest.php       | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php b/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php
index 13ab1f1..8d3badf 100644
--- a/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php
+++ b/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php
@@ -47,7 +47,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
      ];
     $element['langcode'] = [
       '#type' => 'value',
-      '#value' => $items[$delta]->langcode,
+      '#value' => $items[$delta]->langcode ?: $entity->language()->getId(),
     ];
     return $element;
   }
diff --git a/core/modules/path/tests/src/Kernel/PathItemTest.php b/core/modules/path/tests/src/Kernel/PathItemTest.php
index d7627c3..43360fa 100644
--- a/core/modules/path/tests/src/Kernel/PathItemTest.php
+++ b/core/modules/path/tests/src/Kernel/PathItemTest.php
@@ -49,16 +49,31 @@ public function testPathItem() {
 
     $node_storage = \Drupal::entityTypeManager()->getStorage('node');
 
+    // First test with an entity that doesn't have the path field set.
+    $node = Node::create([
+      'title' => 'Testing no path',
+      'type' => 'foo',
+    ]);
+    $this->assertTrue($node->get('path')->isEmpty());
+    $this->assertEquals(0, count($node->get('path')));
+
+    $node->save();
+    $this->assertTrue($node->get('path')->isEmpty());
+    $this->assertEquals(0, count($node->get('path')));
+
+    // Test with an entity with path field set.
     $node = Node::create([
       'title' => 'Testing create()',
       'type' => 'foo',
       'path' => ['alias' => '/foo'],
     ]);
     $this->assertFalse($node->get('path')->isEmpty());
+    $this->assertEquals(1, count($node->get('path')));
     $this->assertEquals('/foo', $node->get('path')->alias);
 
     $node->save();
     $this->assertFalse($node->get('path')->isEmpty());
+    $this->assertEquals(1, count($node->get('path')));
     $this->assertEquals('/foo', $node->get('path')->alias);
 
     $stored_alias = $alias_storage->lookupPathAlias('/' . $node->toUrl()->getInternalPath(), $node->language()->getId());
