register: fix a runtime error with amountless postings

This commit is contained in:
Simon Michael 2015-06-11 09:58:03 -07:00
parent 892718a5d9
commit 049baed4d8

View File

@ -151,7 +151,7 @@ postingsReportItemAsText opts (mdate, menddate, mdesc, p, b) =
bal = showMixedAmountWithoutPrice b
(amtlines, ballines) = (lines amt, lines bal)
(amtlen, ballen) = (length amtlines, length ballines)
numlines = max amtlen ballen
numlines = max 1 (max amtlen ballen)
(amtfirstline:amtrest) = take numlines $ amtlines ++ repeat "" -- posting amount is top-aligned
(balfirstline:balrest) = take numlines $ replicate (numlines - ballen) "" ++ ballines -- balance amount is bottom-aligned
spacer = replicate (totalwidth - (amtwidth + 2 + balwidth)) ' '