--- modules/path/path.module.orig	2009-07-30 05:28:26.000000000 +0100
+++ modules/path/path.module	2009-08-13 14:44:25.000000000 +0100
@@ -197,11 +197,16 @@ function path_form_alter(&$form, $form_s
       '#collapsed' => TRUE,
       '#description' => t('Optionally specify an alternative URL by which this node can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
     );
-    if ($path) {
-      $form['path']['pid'] = array(
-        '#type' => 'value',
-        '#value' => db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s' AND language = '%s'", $path, $form['#node']->language))
-      );
+    // If we are editing a node which has a path alias then store the pid
+    // of the uneditied node's path alias in the form.
+    if (isset($form['#node']->nid)) {
+      $original_node = node_load($form['#node']->nid);
+      if (isset($original_node->path)) {
+        $form['path']['pid'] = array(
+          '#type' => 'value',
+          '#value' => db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s' AND language = '%s'", $original_node->path, $form['#node']->language))
+        );
+      }
     }
   }
 }
