From 18c72baddf3c200252ffd5eac3274351fcec42a7 Mon Sep 17 00:00:00 2001
From: John Ralls <jralls@ceridwen.us>
Date: Tue, 4 May 2021 13:20:01 -0700
Subject: [PATCH] Don't bother scrubbing for orphans if there's no transaction
 currency.

If it found one it would try to create an orphan account with no
currency which will crash later.
---
 libgnucash/engine/Scrub.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libgnucash/engine/Scrub.c b/libgnucash/engine/Scrub.c
index c2607fcb63..5e6e9c0500 100644
--- a/libgnucash/engine/Scrub.c
+++ b/libgnucash/engine/Scrub.c
@@ -110,6 +110,7 @@ TransScrubOrphansFast (Transaction *trans, Account *root)
 
     if (!trans) return;
     g_return_if_fail (root);
+    g_return_if_fail (trans->common_currency);
 
     for (node = trans->splits; node; node = node->next)
     {