? LICENSE.txt
? dialog_834474.patch
Index: dialog.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/dialog/dialog.js,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 dialog.js
--- dialog.js	31 Jan 2011 21:03:40 -0000	1.1.2.5
+++ dialog.js	1 Feb 2011 22:24:56 -0000
@@ -227,32 +227,36 @@
    */
   Drupal.CTools.AJAX.commands.dialog_display = function(command) {
     var $el = Drupal.Dialog.dialog;
-    $el.html(command.output)
-      // remove any previously added buttons
-      .dialog('option', 'buttons', {})
-      .dialog('option', 'title', command.title)
-      .dialog('show');
 
-    var defaultOptions = {
-      height: Drupal.settings.Dialog.height,
-      width: Drupal.settings.Dialog.width,
-      position: 'center',
-      maxHeight: Math.floor($(window).height() * .8)
-    };
-    var o = $.extend(defaultOptions, command.options);
-    for (i in o) {
-      $el.dialog('option', i, o[i]);
-    }
-    if ($el.height() > o.maxHeight) {
-      $el.dialog('option', 'height', o.maxHeight);
-      $el.dialog('option', 'position', o.position);
-      // This is really ugly, but dialog gives us no way to call
-      // _size() in a sane way!
-      $el.data('dialog')._size();
-    }
+    // Ensure that the dialog wasn't closed before the request completed.
+    if ($el) {
+      $el.html(command.output)
+        // remove any previously added buttons
+        .dialog('option', 'buttons', {})
+        .dialog('option', 'title', command.title)
+        .dialog('show');
 
-    Drupal.attachBehaviors($el);
-  }
+      var defaultOptions = {
+        height: Drupal.settings.Dialog.height,
+        width: Drupal.settings.Dialog.width,
+        position: 'center',
+        maxHeight: Math.floor($(window).height() * .8)
+      };
+      var o = $.extend(defaultOptions, command.options);
+      for (i in o) {
+        $el.dialog('option', i, o[i]);
+      }
+      if ($el.height() > o.maxHeight) {
+        $el.dialog('option', 'height', o.maxHeight);
+        $el.dialog('option', 'position', o.position);
+        // This is really ugly, but dialog gives us no way to call
+        // _size() in a sane way!
+        $el.data('dialog')._size();
+      }
+
+      Drupal.attachBehaviors($el);
+    }
+  };
 
   /**
    * AJAX responder command to dismiss the modal.
