Index: generate/project_issue_generate.inc
===================================================================
--- generate/project_issue_generate.inc	(revision 1)
+++ generate/project_issue_generate.inc	(working copy)
@@ -39,8 +39,7 @@
   for ($i = 0; $i < $number; $i++) {
     $project = $projects[array_rand($projects)];
     $project_node = node_load($project->nid);
-    $components = unserialize($project->components);
-    $releases = project_release_get_releases($project_node, FALSE);
+    $components = unserialize($project->components);    
     $issue = array();
     $issue['pid'] = $project->nid;
     $issue['category'] = $categories[array_rand($categories)];
@@ -48,8 +47,14 @@
     $issue['priority'] = array_rand($priorities);
     $issue['title'] = devel_create_greeking(rand(2, 15), true);
     $issue['body'] = devel_create_content();
-    $issue['rid'] = array_rand($releases);
 
+    if (module_exists('project_release')) {
+      // Fetch an array of release versions for this project, and randomly assign
+      // one of them to this issue.
+      $releases = project_release_get_releases($project_node, FALSE);
+      $issue['rid'] = array_rand($releases);
+    }
+
     // The user must be chosen before status (sid) so that we can make sure
     // that the status is set such that the user would have permission to
     // set the status as such.
@@ -111,11 +116,16 @@
     $account = user_load(array('uid' => $users[array_rand($users)]->uid));
     $project = $projects[array_rand($projects)];
     if (rand(0, 1)) {
-      $issues[$k]->pid = $project->nid;
-      // If the project changes, the version must also change.
+      $issues[$k]->pid = $project->nid;      
       $project_node = node_load($issues[$k]->pid, NULL, TRUE);
-      $releases = project_release_get_releases($project_node, FALSE);
-      $issues[$k]->rid = array_rand($releases);
+  
+      if (module_exists('project_release')) {
+        // If the project changes, the version must also change. Fetch a list
+        // of versions for this project and randomly assign one of them to 
+        // the issue.
+        $releases = project_release_get_releases($project_node, FALSE);
+        $issues[$k]->rid = array_rand($releases);
+      }
 
       // And so must the component.
       $components = $project_node->components;
@@ -141,7 +151,7 @@
         continue;
       }
     }
-    if (rand(0, 1)) {
+    if (rand(0, 1) && module_exists('project_release')) {
       $project_node = node_load($issues[$k]->pid, NULL, TRUE);
       $releases = project_release_get_releases($project_node, FALSE);
       $issues[$k]->rid = array_rand($releases);
