diff --git a/userpoints.module b/userpoints.module
index 5094225..ae8bfee 100644
--- a/userpoints.module
+++ b/userpoints.module
@@ -1850,7 +1850,9 @@ function userpoints_userpoints_info() {
  *   A loaded userpoints transaction object.
  */
 function userpoints_transaction_load($txn_id) {
-  $transaction = db_query('SELECT * from {userpoints_txn} WHERE txn_id = :txn', array(':txn' => (int)$txn_id))->fetchObject();
+  if (!empty($txn_id)) {
+    $transaction = db_query('SELECT * from {userpoints_txn} WHERE txn_id = :txn', array(':txn' => $txn_id))->fetchObject();
+  }
   if (!$transaction) {
     return FALSE;
   }
