Crash on opening imported transaction in ledger
Thomas Baumgart
thb at net-bembel.de
Mon Jun 9 11:21:06 BST 2025
On Montag, 2. Juni 2025 01:47:52 CEST Jack Ostroff via KMyMoney-devel wrote:
> I have an investment transaction imported by OFX, and KMM crashes with
> a Floating point exception when I try to open the account in the ledger.
>
> [below lines manually wrapped and memos and some other fields shortened
> for readability.]
>
> From the kmm-statement file for the ofx import:
> <TRANSACTION payee="" amount="2/1" brokerageaccount="" number=""
> action="sell" bankid="ID 20250519CA210057180306067"
> price="0/1" security="ALTABA INC" memo="Exchange: ALTABA INC CASH
> MERGER" reconcile="0" securityId="021ESC017"
> dateposted="2025-05-19" shares="0/1" fees="0/1"/>
>
> This imported as
> <TRANSACTION id="T000000000000034673" postdate="2025-05-19"
> memo="Exchange: ALTABA INC CASH MERGER" entrydate="2025-05-31"
> commodity="USD">
> <SPLITS>
> <SPLIT id="S0001" payee="" reconciledate="" action=""
> reconcileflag="0" value="2/1" shares="2/1" price="0/1"
> memo="Exchange: ALTABA INC CASH MERGER" account="A000345"
> number="" bankid=""/>
> <SPLIT id="S0002" payee="" reconciledate="" action="Buy"
> reconcileflag="0" value="2/1" shares="0/1" price="0/1"
> memo="Exchange: ALTABA INC CASH MERGER" account="A000722"
> number="" bankid="ID 20250519CA210057180306067"/>
> </SPLITS>
> <KEYVALUEPAIRS>
> <PAIR key="Imported" value="true"/>
> </KEYVALUEPAIRS>
> </TRANSACTION>
>
> "Show transaction details" shows the price in both splits as 1, not 0
>
> Clearly this is a strange transaction, since the UI won't let me create
> a buy/sell for 0 shares. I have no idea why Merrill Lynch calls this a
> sell, as it appears to just be some sort of dividend or other payout of
> $2.00.
>
> My assumption is there is a divide by zero, but I can't be sure until I
> trace through the code. If nothing else, shouldn't this type of error
> get trapped and reported instead of crashing?
Here's a fix to get around the division by zero problem:
https://invent.kde.org/office/kmymoney/-/commit/cb810055443cdb5a8dabeb3f87da36b826a8080f
--
Regards
Thomas Baumgart
-------------------------------------------------------------
Growing old is mandatory; growing up is optional.
-- Walt Disney (most likely)
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20250609/5212e723/attachment.sig>
More information about the KMyMoney-devel
mailing list