Index: modules/project_issue/project_issue.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/project_issue/project_issue.module,v
retrieving revision 1.4.2.3
diff -u -r1.4.2.3 project_issue.module
--- modules/project_issue/project_issue.module	17 Sep 2006 00:29:00 -0000	1.4.2.3
+++ modules/project_issue/project_issue.module	16 Dec 2006 22:25:54 -0000
@@ -213,7 +213,7 @@
  */
 function project_issue_alter_project_form(&$form) {
   $node = $form['#node'];
-  if (is_array($node->components)) {
+  if (isset($node->components) && is_array($node->components)) {
     $node->components = implode("\n", $node->components);
   }
   elseif (empty($node->components)) {
@@ -224,7 +224,7 @@
   ** Allow the following fields to be initialized via $_GET
   */
   foreach (array('issues', 'mail_reminder', 'mail_digest') as $field) {
-    if ($_GET['edit'][$field]) {
+    if (!empty($_GET['edit'][$field])) {
       $node->$field = $_GET['edit'][$field];
     }
   }
@@ -256,7 +256,7 @@
   $form['issue']['help'] = array(
     '#type' => 'textarea',
     '#title' => t('Submission guidelines'),
-    '#default_value' => $node->help,
+    '#default_value' => isset($node->help) ? $node->help : NULL,
     '#cols' => 20,
     '#rows' => 5,
   );
@@ -271,7 +271,7 @@
   $form['email']['mail_digest'] = array(
     '#type' => 'textfield',
     '#title' => t('Weekly critical issues report'),
-    '#default_value' => $node->mail_digest,
+    '#default_value' => isset($node->mail_digest) ? $node->mail_digest : NULL,
     '#size' => 20,
     '#maxlength' => 255,
     '#description' => t('To get a weekly digest of critical issues specify an e-mail address.'),
@@ -279,7 +279,7 @@
   $form['email']['mail_copy'] = array(
     '#type' => 'textfield',
     '#title' => t('Issues e-mail address'),
-    '#default_value' => $node->mail_copy,
+    '#default_value' => isset($node->mail_copy) ? $node->mail_copy : NULL,
     '#size' => 20,
     '#maxlength' => 255,
     '#description' => t('If you wish to receive a copy of all the issues to a central location specify an address here.'),
@@ -298,7 +298,7 @@
         '#type' => 'checkbox',
         '#title' => $choice,
         '#return_value' => $key,
-        '#default_value' => $node->mail_copy_filter[$key],
+        '#default_value' => isset($node->mail_copy_filter[$key]) ? $node->mail_copy_filter[$key] : NULL,
       );
     }
     $options = project_issue_state();
@@ -313,7 +313,7 @@
         '#type' => 'checkbox',
         '#title' => $choice,
         '#return_value' => $key,
-        '#default_value' => $node->mail_copy_filter_state[$key],
+        '#default_value' => isset($node->mail_copy_filter_state[$key]) ? $node->mail_copy_filter_state[$key] : NULL,
       );
     }
 
@@ -325,7 +325,7 @@
       '#type' => 'checkbox',
       '#title' => t('Send monthly reminders to users'),
       '#return_value' => 1,
-      '#default_value' => $node->mail_reminder,
+      '#default_value' => isset($node->mail_reminder) ? $node->mail_reminder : NULL,
       '#description' => t('Enabling this will send a monthly reminder to users that have open issues registered.'),
     );
   }
@@ -386,7 +386,7 @@
     }
   }
 
-  if (!$user) {
+  if (empty($user)) {
     global $user;
     $current_user = TRUE;
   }
@@ -466,6 +466,11 @@
 
 function project_issue_project_load(&$node, $arg) {
   $project = db_fetch_object(db_query('SELECT * FROM {project_issue_projects} WHERE nid = %d', $node->nid));
+  // If nothing loaded, bail immediately
+  if (!$project) {
+    return $node;
+  }
+  //assert($project);
   $node->components = unserialize($project->components);
   $node->mail_copy_filter = unserialize($project->mail_copy_filter);
   $node->mail_copy_filter_state = unserialize($project->mail_copy_filter_state);
