From e766efe99808c28903d047ec476355b4b34162bf Mon Sep 17 00:00:00 2001
From: Tom Kirkpatrick <tom@systemseed.com>
Date: Fri, 27 Apr 2012 13:03:58 +0200
Subject: [PATCH] Only run submit hander if the pane still exists (allow for
 conditional panes)

---
 commerce_fieldgroup_panes.module |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/commerce_fieldgroup_panes.module b/commerce_fieldgroup_panes.module
index 9de273b..9527484 100644
--- a/commerce_fieldgroup_panes.module
+++ b/commerce_fieldgroup_panes.module
@@ -78,6 +78,11 @@ function commerce_fieldgroup_panes_contents_checkout_form($form, &$form_state, $
  * Implements the callback for the checkout pane form submit
  */
 function commerce_fieldgroup_panes_contents_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {
+  // Do nothing unless the checkout pane still exists.  
+  if (!isset($form[$checkout_pane['pane_id']])) {
+    return;
+  }
+
   // Notify field widgets -> attach the $form_state['values'] to the $order object
   field_attach_submit('commerce_order', $order, $form[$checkout_pane['pane_id']], $form_state);
 
-- 
1.7.4.4

