--- javascript_aggregator.module	Wed May 20 16:39:34 2009
+++ javascript_aggregator.module	Sat May 23 01:26:25 2009
@@ -106,32 +106,34 @@
     $pattern = "!(<script type=\"text\/javascript\" src=\"$path)(.*?)(\"(.*?)><\/script>)!";
     preg_match_all($pattern, $scripts_variale, $matches);
     $aggregated_file = $matches[2][0];
-    $jsmin_file = $aggregated_file .'min.js';
+    if (!empty($aggregated_file)) {
+      $jsmin_file = $aggregated_file .'min.js';
 
-    // Construct the final JSMin file path.
-    $jsmin_file_path = file_directory_path() . $jsmin_file;
+      // Construct the final JSMin file path.
+      $jsmin_file_path = file_directory_path() . $jsmin_file;
 
-    // Create the JSMinified file if it doesn't exist yet.
-    if (!file_exists($jsmin_file_path)) {
-      // JSMin the contents of the aggregated file.
-      require_once(drupal_get_path('module', 'javascript_aggregator') .'/jsmin.php');
-      $contents = JSMin::minify(file_get_contents(file_directory_path() . $aggregated_file));
-      if (variable_get('javascript_aggregator_gzip', FALSE)) {
+      // Create the JSMinified file if it doesn't exist yet.
+      if (!file_exists($jsmin_file_path)) {
+        // JSMin the contents of the aggregated file.
+        require_once(drupal_get_path('module', 'javascript_aggregator') .'/jsmin.php');
+        $contents = JSMin::minify(file_get_contents(file_directory_path() . $aggregated_file));
+        if (variable_get('javascript_aggregator_gzip', FALSE)) {
 
-        // Create the GZip file if it doesn't already exist.
-        if (!file_exists($jsmin_file .'.gz')) {
-          file_save_data(gzencode($contents, 9), $jsmin_file .'.gz', FILE_EXISTS_REPLACE);
+          // Create the GZip file if it doesn't already exist.
+          if (!file_exists($jsmin_file_path .'.gz')) {
+            file_save_data(gzencode($contents, 9), $jsmin_file_path .'.gz', FILE_EXISTS_REPLACE);
+          }
         }
+      
+        _javascript_aggregator_htaccess();
+
+        // Save the contents to the JavaScript file.
+        file_save_data($contents, $jsmin_file_path, FILE_EXISTS_REPLACE);
       }
-    
-      _javascript_aggregator_htaccess();
 
-      // Save the contents to the JavaScript file.
-      file_save_data($contents, $jsmin_file_path, FILE_EXISTS_REPLACE);
+      // Replace the aggregated file with the minified JavaScript file.
+      $scripts_variale = str_replace($aggregated_file, $jsmin_file, $scripts_variale);
     }
-
-    // Replace the aggregated file with the minified JavaScript file.
-    $scripts_variale = str_replace($aggregated_file, $jsmin_file, $scripts_variale);
   }
   
   return $scripts_variale;
