diff --git a/src/business/business-gnome/dialog-payment.c b/src/business/business-gnome/dialog-payment.c
index 1f1c97b..9888ff0 100644
--- a/src/business/business-gnome/dialog-payment.c
+++ b/src/business/business-gnome/dialog-payment.c
@@ -53,6 +53,8 @@
 #include "dialog-transfer.h"
 #include "gnome-search/gnc-general-search.h"
 
+static QofLogModule log_module = G_LOG_DOMAIN;
+
 #define DIALOG_PAYMENT_CUSTOMER_CM_CLASS "customer-payment-dialog"
 #define DIALOG_PAYMENT_VENDOR_CM_CLASS "vendor-payment-dialog"
 
@@ -261,12 +263,17 @@ calculate_selected_total_helper (GtkTreeModel *model,
     g_value_unset (&value);
 
     /* Find the amount's currency to determine the required precision */
-    acct = gnc_lot_get_account (lot);
-    currency = xaccAccountGetCommodity (acct);
+    if (GNC_IS_LOT (lot))
+    {
+        acct = gnc_lot_get_account (lot);
+        currency = xaccAccountGetCommodity (acct);
 
-    cur_val = gnc_lot_get_balance (lot);
-    *subtotal = gnc_numeric_add (*subtotal, cur_val,
-                                 gnc_commodity_get_fraction (currency), GNC_HOW_RND_ROUND_HALF_UP);
+        cur_val = gnc_lot_get_balance (lot);
+        *subtotal = gnc_numeric_add (*subtotal, cur_val,
+                                     gnc_commodity_get_fraction (currency), GNC_HOW_RND_ROUND_HALF_UP);
+    }
+    else
+        PWARN("%p is not a valid lot", lot);
 }
 
 static gnc_numeric
