diff --git a/includes/export-ui.inc b/includes/export-ui.inc
index 16e57d6..4dbe033 100644
--- a/includes/export-ui.inc
+++ b/includes/export-ui.inc
@@ -458,18 +458,18 @@ function ctools_export_ui_switcher_page($plugin_name, $op) {
 
   // Load the $plugin information
   $plugin = ctools_get_export_ui($plugin_name);
-  $handler = ctools_export_ui_get_handler($plugin);
-
-  if ($handler) {
-    $method = $op . '_page';
-    if (method_exists($handler, $method)) {
-      // replace the first two arguments:
-      $args[0] = $js;
-      $args[1] = $_POST;
-      return call_user_func_array(array($handler, $method), $args);
+  if ($plugin) {
+    $handler = ctools_export_ui_get_handler($plugin);
+    if ($handler) {
+      $method = $op . '_page';
+      if (method_exists($handler, $method)) {
+        // replace the first two arguments:
+        $args[0] = $js;
+        $args[1] = $_POST;
+        return call_user_func_array(array($handler, $method), $args);
+      }
     }
   }
-  else {
-    return t('Configuration error. No handler found.');
-  }
+
+  return t('Configuration error. No handler found.');
 }
